Agents¶
The class attributes an agent subclass may set, and the fields of
the result one run returns. Generated from the Agent and
ACPAgent classes and from AgentResult. How to use them is in
Dispatching agents.
Agent¶
system_prompt: str | None = Noneoutput_model: type[BaseModel] | None = Noneask_policy: Literal['off', 'http'] = 'off'
ACPAgent¶
Adds to Agent, and inherits the three above.
command: list[str] = ['npx', 'pi-acp']model: str | None = Nonethinking: str | None = Nonepermission_policy: Literal['ask', 'auto_allow', 'auto_deny'] = 'ask'permission_timeout: float | None = Nonepermission_timeout_action: Literal['deny', 'allow'] = 'deny'elicitation_policy: Literal['ask', 'decline'] = 'ask'max_repair_turns: int = 2env_allowlist: list[str] | None = Nonetooling: Literal['auto', 'mcp', 'native', 'http', 'none'] = 'auto'client_class: type[ACPClient] = ACPClientstats_provider: SessionStatsProvider | None = None
AgentSession¶
What open() yields; run() is open() plus one prompt().
session_id: strawait prompt(prompt: str = '') -> AgentResult- One assignment on the held session; the result is the prompt's.
AgentResult¶
status: Literal['complete', 'failed'] = 'complete'output: Any = Nonetext: str = ''session_id: str | None = Nonestop_reason: str | None = Noneerror: str | None = Nonestats: dict[str, Any] = dict()ok: property. Whether the run completed.status="failed"is not an error.