cape.agent: Agentic interface to CAPE

The main interface for running the interactive cape agentic conversation or a single cape agent turn, passing user responses to an external LLM, and processing the results. Interactive sessions use the Textual interface when available, with the traditional readline loop as a fallback. Most of the actual capability is implemented by cape.agent.agentcntl.AgentCntl.

cape.agent.main(cls: type | None = None, tui: bool | None = None) → AgentResult

Run an interactive CAPE-agent session

The Textual interface is selected automatically when Textual is installed and stdin/stdout are attached to a capable terminal. Pass tui=False to force the traditional readline interface.

cape.agent.run(user_message: str) → AgentResult

Run one noninteractive CAPE agent turn

Call:
>>> ierr, result = run(user_message)
Inputs:
user_message: str

Prompt to send to the CAPE agent

Outputs:
ierr: int

Return code

result: dict

Information about tool calls made during the turn

Interactive cape agentic sessions use the Textual interface when the optional dependency and a capable terminal are available. Use --no-agent-tui to force the traditional readline interface. The single-turn cape agent <prompt> command remains noninteractive.