create_agent: the agent harness
Notebook· 02.03· 120–150 min· Lesson 21 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Build an agent with
create_agent(model, tools, system_prompt=...)and explain what it adds to the loop you wrote in 02.02. - Read an agent's graph (
modelandtoolsnodes) and its result (messages, the final answer, step counts). - Bound every run:
recursion_limit,GraphRecursionError, andModelCallLimitMiddleware, and know why the default limit is no protection. - Extend state with
state_schemaand change the prompt per request with@dynamic_prompt. - Choose the model per step with
wrap_model_call(cheap model first, bigger one later). - Migrate old
create_react_agentcode tocreate_agent.
Before you start
Lesson 02.02 (the loop by hand).
