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, cache_mode=CacheMode.READ_WRITE, steering_mode='all')[源代码]#

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

cache_mode#

How this request may use the provider's prompt cache. READ reuses a cached prefix without marking this request's new content; READ_WRITE also extends the cache; OFF sends no cache directive. Providers that cache automatically have no client-side write control, so they treat READ and READ_WRITE alike. See CacheMode.

Type:

zett_agent.model.CacheMode

steering_mode#

"all" (default) adopts every queued steering message together at the next model/tool boundary. "one" adopts one at a time. Each message retains its own content, metadata and events.

Type:

Literal['all', 'one']

抛出:

ValueError -- If an identity is empty, a session references itself, or cache_mode or steering_mode is invalid.

参数:
  • session_id (str | None)

  • request_id (str | None)

  • parent_session_id (str | None)

  • cache_key (str | None)

  • cache_mode (CacheMode)

  • steering_mode (Literal['all', 'one'])

示例

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.