AgentRunConfig#

Understand request ownership, phases, and runtime limits. See the guide.

class zett_agent.agent.AgentRunConfig(session_id=None, request_id=None, parent_session_id=None, cache_key=None)[源代码]#

Identify a conversation and optionally one request within it.

session_id#

Conversation identifier, reused across turns. None or an empty value is replaced by a new UUIDv7 when the runtime starts.

Type:

str | None

request_id#

Optional application correlation ID for this invocation. It is not an idempotency key; reusing it does not deduplicate messages.

Type:

str | None

parent_session_id#

Parent conversation when running a delegated child. Must differ from session_id.

Type:

str | None

cache_key#

Prompt cache routing key declared to the provider. None reuses session_id, which keeps every step of one conversation on the same cached prefix; set it to route several conversations onto one prefix instead.

Type:

str | None

抛出:

ValueError -- If an identity is empty or a session references itself.

参数:
  • session_id (str | None)

  • request_id (str | None)

  • parent_session_id (str | None)

  • cache_key (str | None)

示例

A root conversation needs only a session ID:

config = AgentRunConfig(session_id="chat-42")

A delegated agent identifies its parent separately:

child = AgentRunConfig(
    session_id="review-42",
    request_id="request-7",
    parent_session_id="chat-42",
)

备注

request_id is correlation data, not an idempotency key. Reusing it does not suppress a second message or model call.

参见

SQLiteSessionStorage for persisted session identity, and SubAgentDefinition for child-session setup.