# langchain-ai/langgraph-example-pyproject architecture

> Architecture diagram of the GitHub repository langchain-ai/langgraph-example-pyproject, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langchain-ai/langgraph-example-pyproject
- Repository: https://github.com/langchain-ai/langgraph-example-pyproject

## Overview

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: [`my_agent/utils/nodes.py`](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py) (Model call), [`my_agent/agent.py`](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/agent.py) (Agent graph), [`my_agent/utils/tools.py`](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/tools.py) (Tavily search tool), [`my_agent/utils/state.py`](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/state.py) (Message state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Agent orchestration"]
  node_workflow["Agent graph<br/>[agent.py]"]
  node_state["Message state<br/>[state.py]"]
end

subgraph group_logic["Agent logic"]
  node_model_node["Model call<br/>[nodes.py]"]
  node_router["Tool-call router<br/>[nodes.py]"]
  node_tool_node["Tool executor<br/>[nodes.py]"]
end

subgraph group_integrations["Model and search integrations"]
  node_tool_config["Tavily search tool<br/>[tools.py]"]
  node_model_service["Chat model"]
  node_tavily["Tavily Search"]
end

node_user(("Caller"))

node_user -.->|"submits messages"| node_workflow
node_workflow -->|"dispatches model"| node_model_node
node_workflow -->|"dispatches action"| node_tool_node
node_workflow -->|"checks continuation"| node_router
node_workflow -->|"uses state"| node_state
node_model_node -->|"reads messages"| node_state
node_model_node -->|"returns response"| node_state
node_model_node -->|"invokes model"| node_model_service
node_model_node -->|"binds tools"| node_tool_config
node_tool_node -->|"executes tools"| node_tool_config
node_tool_config -->|"searches web"| node_tavily
node_router -->|"continues on calls"| node_tool_node
node_tool_node -->|"cycles back"| node_model_node

click node_workflow "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/agent.py"
click node_state "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/state.py"
click node_model_node "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py"
click node_router "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py"
click node_tool_node "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py"
click node_tool_config "https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/tools.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workflow,node_state toneBlue
class node_model_node,node_router,node_tool_node toneAmber
class node_tool_config,node_model_service,node_tavily toneMint
class node_user toneIndigo
```

## Components

### Agent orchestration

- [Agent graph](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/agent.py): `my_agent/agent.py`
- [Message state](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/state.py): `my_agent/utils/state.py`

### Agent logic

- [Model call](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py): `my_agent/utils/nodes.py`
- [Tool-call router](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py): `my_agent/utils/nodes.py`
- [Tool executor](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/nodes.py): `my_agent/utils/nodes.py`

### Model and search integrations

- [Tavily search tool](https://github.com/langchain-ai/langgraph-example-pyproject/blob/main/my_agent/utils/tools.py): `my_agent/utils/tools.py`
- **Chat model**
- **Tavily Search**

### Other components

- **Caller**

## Connections

- Caller → Agent graph: submits messages
- Agent graph → Model call: dispatches model (evidence: `my_agent/agent.py`)
- Agent graph → Tool executor: dispatches action (evidence: `my_agent/agent.py`)
- Agent graph → Tool-call router: checks continuation (evidence: `my_agent/agent.py`)
- Agent graph → Message state: uses state (evidence: `my_agent/agent.py`)
- Model call → Message state: reads messages (evidence: `my_agent/utils/nodes.py`)
- Model call → Message state: returns response (evidence: `my_agent/utils/nodes.py`)
- Model call → Chat model: invokes model (evidence: `my_agent/utils/nodes.py`)
- Model call → Tavily search tool: binds tools (evidence: `my_agent/utils/nodes.py`)
- Tool executor → Tavily search tool: executes tools (evidence: `my_agent/utils/nodes.py`)
- Tavily search tool → Tavily Search: searches web (evidence: `my_agent/utils/tools.py`)
- Tool-call router → Tool executor: continues on calls (evidence: `my_agent/agent.py`)
- Tool executor → Model call: cycles back (evidence: `my_agent/agent.py`)
