> ## Documentation Index
> Fetch the complete documentation index at: https://darwin.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LangChain / LangGraph

> Build a durable Darwin workflow with explicit graph state.

Represent Darwin identifiers and states directly in your graph rather than keeping them only in messages.

[Copy the LangChain / LangGraph MCP recipe](https://github.com/darwin-studios/darwin-integrations/blob/main/frameworks/langchain-langgraph.md).

## Suggested state

```text theme={null}
query → search results → selected capability revision → actionId → current Action state
```

Use separate nodes or tools for Search, Start, Get, Update, Approve, and Stop. Route from `availableActions`; do not infer valid transitions from elapsed time or model prose.

Checkpoint before and after each Action mutation so retries can reuse the same `requestId` and avoid duplicate work.

## Suggested nodes

| Node       | Reads                               | Writes                             |
| ---------- | ----------------------------------- | ---------------------------------- |
| `search`   | user intent and hard filters        | canonical result page              |
| `select`   | result page and user choice         | capability ID and revision         |
| `start`    | pinned revision, inputs, request ID | Action ID and current state        |
| `route`    | `availableActions` and status       | next node                          |
| `interact` | exact Darwin interaction            | user-controlled update or decision |
| `recover`  | stored Action ID                    | refreshed current state            |

Never route directly from model sentiment such as “looks done.” Route from Darwin's structured response and checkpoint the result.
