SubAgentTask#

Build extensions, choose hooks, and manage request-scoped state. See the guide.

class zett_agent.extensions.async_subagent.SubAgentTask(task_id, parent_session_id, session_id, subagent_type, description, prompt, status=SubAgentTaskStatus.RUNNING, started_at=<factory>, finished_at=None, content=None, stop=None, error=None, notified=False, _runner=None)[源代码]#

One background task owned by an AsyncSubAgentExtension.

The extension mutates a task as the child runs. Tools and hosts read SubAgentTaskInfo snapshots instead of holding this object.

参数:
  • task_id (str)

  • parent_session_id (str)

  • session_id (str)

  • subagent_type (str)

  • description (str)

  • prompt (str)

  • status (SubAgentTaskStatus)

  • started_at (float)

  • finished_at (float | None)

  • content (str | None)

  • stop (StopInfo | None)

  • error (str | None)

  • notified (bool)

  • _runner (Task[None] | None)

task_id#

Identifier the parent model uses, unique within its session.

Type:

str

parent_session_id#

Session that started the task and may inspect it.

Type:

str

session_id#

Child session created for the work, for storage and replay.

Type:

str

subagent_type#

Name of the SubAgentDefinition that runs it.

Type:

str

description#

Short summary written by the parent model.

Type:

str

prompt#

Complete instructions given to the child.

Type:

str

status#

Current lifecycle state.

Type:

zett_agent.extensions.async_subagent.SubAgentTaskStatus

started_at#

Monotonic start time, in seconds.

Type:

float

finished_at#

Monotonic end time, or None while running.

Type:

float | None

content#

The child's final report once completed.

Type:

str | None

stop#

Why the child stopped early, when it did not finish normally; None otherwise. A task whose child was refused or cut off is still completed: the status says the child ended, and this says it did not finish.

Type:

zett_agent.stop.StopInfo | None

error#

Failure description once failed.

Type:

str | None

notified#

Whether the parent was told that the task finished.

Type:

bool

property finished: bool#

Whether the task reached a terminal status.

property elapsed: float#

Seconds the task ran, or has been running so far.