Agent runtime#
Understand request ownership, phases, and runtime limits.
Read the walkthrough before consulting individual signatures.
Interface |
Purpose |
|---|---|
Run a model, execute requested tools, and repeat until an answer is ready. |
|
Identify a conversation and optionally one request within it. |
|
Per-run references shared by all lifecycle hooks. |
|
Mutable conversation state created independently for one request. |
|
Carry one run’s ordered events from the runtime task to |
|
Base exception for runtime and provider errors. |
|
The model/tool loop exceeded its configured limit. |
|
A model stream did not produce exactly one final response. |
|
A session has nothing that can be resumed, or what it has cannot be picked up again. |
|
A model step ended for a reason other than finishing, and the caller asked to be told. |
|
Return a time-ordered UUIDv7 string for persisted runtime records. |
|
What resuming does, which depends on how the request was interrupted. |
|
Where a session was interrupted and what resuming it will do. |
|
Read where a history was interrupted from its last message. |
|
Why one model step stopped, normalized, with what the provider said kept. |
|
Provider-neutral reason a model step ended. |
|
Turn a provider’s raw stop value into a |
|
An initialized Agent callable from ordinary synchronous Python code. |
|
Use a model whose stream(request) returns an ordinary synchronous iterator. |
|
Create a synchronous Agent with the same options as create_agent. |
|
Adapt async with to ordinary with without changing the yielded value. |
|
A blocking view of an existing Agent, provider, tool, or storage object. |
|
Own one background event loop for all blocking calls in a scope. |
|
Pull async events synchronously, preserving one task and bounded memory. |