A lightweight orchestration layer that chains two existing LangGraph projects into a single pipeline:
data-cleaning-agent: LLM-driven data cleaningeda-workflow: automated first-pass exploratory data analysis
Flow: raw CSV → PII guardrail → clean data → EDA report
DataAnalystAgent demonstrates agent-to-agent orchestration without rewriting either sub-project. The parent graph handles state passing, input guardrails (PII detection), and conditional routing (e.g. blocking the pipeline when PII is found, or skipping EDA when cleaning fails).
- Python 3.10 or 3.11
- Poetry
- OpenAI API key
From this folder:
poetry installCopy the example environment file and fill in your key:
cp .env.example .envThen edit .env and set your OpenAI API key:
OPENAI_API_KEY=sk-your-key-herepoetry run python example_usage.pydata-analyst-agent/
├── data_analyst_agent/
│ ├── __init__.py
│ ├── guardrails.py
│ ├── orchestrator.py
│ └── orchestrator_reference.py
├── .env.example
├── example_usage.py
├── pyproject.toml
└── README.md
orchestrator.py— Student version with TODOs to complete.orchestrator_reference.py— Complete solution for reference.guardrails.py— PII column detection guardrail.
Running example_usage.py saves three graph diagrams by default:
| File | Graph |
|---|---|
graph.png |
Parent orchestration graph |
cleaning_graph.png |
data-cleaning-agent package |
eda_graph.png |
eda-workflow package |
Use DataAnalystAgent.save_graph_diagrams() to control which diagrams are written. Pass None for any filename to skip it:
agent.save_graph_diagrams(
orchestrator_filename="graph.png",
cleaning_filename="cleaning_graph.png",
eda_filename=None, # skip EDA diagram
)Set xray=True to expand nested subgraph internals in the orchestrator diagram.
To enable tracing, set the LangSmith variables in your .env file. If they are not set, the pipeline runs normally without tracing.
- Both sub-projects (
data-cleaning-agentandeda-workflow) are linked as local path dependencies inpyproject.toml. This means they are expected to live in sibling directories (e.g.../data-cleaning-agentand../eda-workflow). When you runpoetry install, Poetry resolves them from those local paths rather than from PyPI. - A PII guardrail runs before any LLM call and blocks the pipeline if sensitive columns are detected.
- If cleaning fails, EDA is skipped.