How langchain-ai/langgraph-example-pyproject works
This is a small LangGraph conversational agent: it accepts message state, calls a configurable Anthropic or OpenAI model, routes tool-call responses through Tavily search, and cycles back to the model until it can finish. The graph and node implementations are shown; deployment and HTTP handling are described generally in the README but are not implemented in the sampled source, so they are not modeled as components.
Main entry points: nodes.py Model call · agent.py Agent graph · tools.py Tavily search tool · state.py Message state
Components 9
Agent orchestration
- Agent graph
my_agent/agent.py - Message state
my_agent/utils/state.py
Agent logic
- Model call
my_agent/utils/nodes.py - Tool-call router
my_agent/utils/nodes.py - Tool executor
my_agent/utils/nodes.py
Model and search integrations
- Tavily search tool
my_agent/utils/tools.py - Chat model
- Tavily Search
Other components
- Caller
Connections 13
- Caller → Agent graph: submits messages
- Agent graph → Model call: dispatches model
my_agent/agent.py - Agent graph → Tool executor: dispatches action
my_agent/agent.py - Agent graph → Tool-call router: checks continuation
my_agent/agent.py - Agent graph → Message state: uses state
my_agent/agent.py - Model call → Message state: reads messages
my_agent/utils/nodes.py - Model call → Message state: returns response
my_agent/utils/nodes.py - Model call → Chat model: invokes model
my_agent/utils/nodes.py - Model call → Tavily search tool: binds tools
my_agent/utils/nodes.py - Tool executor → Tavily search tool: executes tools
my_agent/utils/nodes.py - Tavily search tool → Tavily Search: searches web
my_agent/utils/tools.py - Tool-call router → Tool executor: continues on calls
my_agent/agent.py - Tool executor → Model call: cycles back
my_agent/agent.py