Basic Concepts
AgentLoop
The orchestrator. Runs a step-based loop: call LLM, execute tools, check stop conditions, repeat.AgentState
Immutable value object holding everything about an agent’s session and execution. Session data (persists across executions):agentId- unique identifiercontext- messages, system prompt, metadatabudget- resource limits (steps, tokens, time)
execution- currentExecutionStatewith steps, status, continuation signals
AgentContext
Holds the conversation data: messages, system prompt, metadata, and response format. The driver’sCanCompileMessages compiler transforms the context into the final Messages sent to the LLM.
AgentStep
An immutable snapshot of a single loop iteration:inputMessages- what was sent to the LLMoutputMessages- tool results + assistant responseinferenceResponse- raw LLM responsetoolExecutions- results of executed toolsstepType()-FinalResponse,ToolExecution, orError
StepExecution
Wraps anAgentStep with timing and continuation data. Stored in the completed steps list after each iteration.