Skip to content

API Reference parrot.cli.events

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.cli.events

View source

Presentation-neutral turn lifecycle events for the Parrot agent CLI (FEAT-573 M4).

One TurnRunner (parrot/cli/session.py) produces these; the inline REPL and the Textual workspace consume them. Nothing here performs I/O.

Class BackendCapabilities

What a bot-like backend can do; read by TurnRunner via getattr(bot, 'capabilities', None).

Fields:

Field Type Default Description
streaming bool True
live_tool_events bool False
usage bool False
resume bool False

Alias CommandContext

Re-exported from parrot.cli.commands.CommandContext.

Alias ConversationTurn

Re-exported from parrot.cli.commands.ConversationTurn.

Attribute PostTurnHook

Class TextDelta

Attributes:

Attribute Type Description
kind TurnEventKind
text str

Class ToolFailed

Attributes:

Attribute Type Description
kind TurnEventKind
call_id str
tool_name str
duration_ms float
error_type str
error_message str

Class ToolFinished

Attributes:

Attribute Type Description
kind TurnEventKind
call_id str
tool_name str
duration_ms float
result_status str
result_size_bytes int

Class ToolStarted

call_id is the lifecycle event's trace_context.span_id; args_summary is already truncated.

Attributes:

Attribute Type Description
kind TurnEventKind
call_id str
tool_name str
args_summary dict[str, Any]

Class TurnCancelled

Attributes:

Attribute Type Description
kind TurnEventKind
partial_text str

Class TurnCompleted

message is the AIMessage or backend response object (duck-typed: .output/.response/.tool_calls/.usage).

Attributes:

Attribute Type Description
kind TurnEventKind
text str
message Any

Class TurnEvent

Base event: seq is monotonic per turn (starts at 0), at is wall-clock.

Fields:

Field Type Default Description
kind TurnEventKind
turn_id str
seq int
at datetime

Class TurnEventKind

Discriminator for :class:TurnEvent subclasses.

Class TurnFailed

Attributes:

Attribute Type Description
kind TurnEventKind
error_type str
error_message str
partial_text str

Class TurnStarted

Attributes:

Attribute Type Description
kind TurnEventKind
query str
streaming bool

Function summarize_message_text

output if str, else response, else json.dumps(output) — mirrors renderer.py:98-112. Never raises.

summarize_message_text(message: Any) -> str

Parameter Type Default Description
message Any

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally