AgentState#
Understand request ownership, phases, and runtime limits. See the guide.
- class zett_agent.agent.AgentState(_messages=<factory>, phase=AgentPhase.CREATED, parent_session_id=None)[源代码]#
Mutable conversation state created independently for one request.
Extensions populate
messagesduringAgentSetupHooksMixin.on_state(). The runtime ownsphaseand validates every transition; extensions should observe phase events instead of assigning it directly.flowchart LR created[CREATED] --> loading[LOADING_CONTEXT] loading --> ready[READY] ready --> generating[GENERATING] generating --> readyA minimal request phase cycle#
A later request for the same session receives a fresh
AgentState. History survives only when a memory or persistence extension restores it.参见
AgentPhasedocuments the state machine, whileSessionViewdescribes restored persistent context.- 参数:
_messages (list[AnyMessage])
phase (AgentPhase)
parent_session_id (str | None)
- property messages: tuple[AnyMessage, ...]#
Return a read-only view of the current message sequence.