Request lifecycle
Key design decisions
- No LangGraph — orchestration is plain Python
asyncioand async generators. Context.stateis a shared mutable dict across the call tree. UseEventActions.state_deltato persist changes back to the session.Context.event_callbackenables real-time event streaming from tools.LlmAgentinjects anasyncio.Queue-based callback before tool execution;AgentTooluses it to push sub-agent events as they arrive. Any custom tool can use the same mechanism.LlmRequest/LlmResponseisolate LangChain types from the rest of the SDK. Swap the LLM provider without touching agent logic.- Planners are per-turn hooks, not static prompts. They receive the live context and request so they can make dynamic decisions each turn.
Custom session backend
Custom planner
LlmAgent via planner=MyPlanner().