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 messages during AgentSetupHooksMixin.on_state(). The runtime owns phase and 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 --> ready
    

A 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.

参见

AgentPhase documents the state machine, while SessionView describes restored persistent context.

参数:
property messages: tuple[AnyMessage, ...]#

Return a read-only view of the current message sequence.