Chat models and messages
Every agent node that thinks is a call to a chat model. See how one function creates a model from any provider, how a conversation is a list of four kinds of message, and what a tool call looks like inside an AIMessage.
11 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 11 minutes.
Written from the official documentation
In this module: Models, tools and agents
- Chat models and messagesinit_chat_model, message types, content blocks and tool calls.Pro
- Tools and bind_toolsDefine tools, bind them to a model and run them with ToolNode.Pro
- Tools that read state and storeToolRuntime gives tools state, context, store and a stream writer.Pro
- Structured outputGet typed results with provider or tool calling strategies.Pro
- The agent loop as a graphModel node, tool node and one conditional edge that loops.Pro
- The prebuilt agent: create_agentA ready made agent graph you shape with middleware.Pro