Back to feed
Dev.to
Dev.to
8/4/2026
An agent is a graph

An agent is a graph

Short summary

A tutorial on building a Claude-based chatbot called Claudius, treating the agent as a LangGraph state machine with three nodes: context loading, model invocation, and tool execution. The key design decision is passing the model per-run via configurable channels rather than compiling it into the graph, enabling seamless mid-conversation model switching (e.g., Haiku to Sonnet) without losing state. Includes TypeScript code for the graph construction and agent node implementation.

  • Agent chat engine is built as a LangGraph state machine with load_context, agent, and tools nodes
  • Model is chosen per-run via configurable channels, not compiled into the graph
  • Enables mid-conversation model switching (e.g., Haiku to Sonnet) without losing conversation state

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more