Step 4 - LangGraph Todo Agent CLI¶
Overview¶
This step adds a minimal LangGraph + Microsoft Foundry CLI at
scripts/langgraph/vanilla.py.
The agent talks to the Todo Web API through tools and supports:
- one-shot mode:
run - interactive mode:
chat
Prerequisites¶
Start the Todo API in another terminal:
Make sure your .env contains Microsoft Foundry settings (same as previous
steps).
Usage¶
One-shot mode¶
Interactive mode¶
Common options:
--endpoint/-e: Todo API base URL (CLI value >TODO_API_ENDPOINT> default)--model/-M: model string forinit_chat_model--timeout: HTTP timeout seconds--thread-id: LangGraph thread id
chat also supports --system for overriding the system prompt.
Slash commands (chat)¶
/exit,/quit: leave REPL/reset: reset conversation thread id/help: show commands and tools/tools: show tool signatures/thread: show current thread id
Observability¶
Like scripts/microsoft_foundry/vanilla.py, this CLI supports:
--tracing/-t: Azure Monitor / Foundry tracing--mlflow/-m: MLflow autologging--verbose/-v: DEBUG logs
Example:
Troubleshooting¶
If the Todo API is unreachable or returns 4xx/5xx, tools return structured error dictionaries (instead of throwing), so the agent can retry or recover.
Check:
todo-webis running--endpointpoints to the correct host/port- request/response details under
--verbose
Further Reading¶
The same LangGraph agent pattern can be integrated into the
Cloud Agent service so that it runs as an
async background task. The LangGraphAgent class in
concierge/agents/infrastructure/langgraph_agent.py is a minimal
reference implementation that follows the same create_agent API used
in this tutorial; the langgraph preset registered in
registry_factory.py wires it up with echo and generate_image_tool
tool builders so the LLM can pick the right one per request.
See the
Cloud Agent CLI docs
for a dispatch example.