Skip to content

API Reference parrot.bots.flows.plan.delegate.protocol

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

parrot.bots.flows.plan.delegate.protocol

View source

Tool-call delegate contract (FEAT-590): a tool-calling-only local model.

A delegate proposes exactly one tool call from a short instruction; it never chats, never produces free text, and never executes anything. Code disposes.

Class DelegateBackendError

The backend itself failed — distinct from a rejected proposal.

Class DelegateTrace

One proposal's audit record — one fine-tuning row.

Fields:

Field Type Default Description
plan_run_id Optional[str] None
node_id str
item_index Optional[int] None
instruction str
facts Dict[str, str]
tools List[str]
proposal ToolCallProposal
verdict Verdict
final_call Optional[Dict[str, Any]] None
created_at datetime

Class DelegateTraceSink

Where traces go. Implementations must never raise into the node.

Method DelegateTraceSink.record

Persist a trace without raising into the execution node.

record(trace: DelegateTrace) -> None

Parameter Type Default Description
trace DelegateTrace

Class JsonlTraceSink

Append-only JSONL sink; opt-in; never written into context/checkpoints/manifest.

Parameter Type Default Description
path Union[str, Path]
max_field_chars int 2000
redact Optional[Callable[[DelegateTrace], DelegateTrace]] None

Method JsonlTraceSink.record

Redact, cap, append one line. Logs and returns on any failure.

record(trace: DelegateTrace) -> None

Parameter Type Default Description
trace DelegateTrace

Class ToolCallDelegate

Tool-calling-only local model. Never chats, never produces free text.

Attributes:

Attribute Type Description
backend_name str
max_tools int
max_input_chars int

Method ToolCallDelegate.propose_call

Propose ONE call without executing it. Raises DelegateBackendError on backend failure.

propose_call(instruction: str, tools: Sequence[ToolSpec], facts: Optional[Mapping[str, str]] = None) -> ToolCallProposal

Parameter Type Default Description
instruction str
tools Sequence[ToolSpec]
facts Optional[Mapping[str, str]] None

Returns: ToolCallProposal

Method ToolCallDelegate.extract

Short-text structured extraction; None when nothing fits.

extract(text: str, schema: Union[Type[BaseModel], Dict[str, Any]]) -> Optional[Dict[str, Any]]

Parameter Type Default Description
text str
schema Union[Type[BaseModel], Dict[str, Any]]

Returns: Optional[Dict[str, Any]]

Method ToolCallDelegate.aclose

Release pools, processes, sessions. Idempotent.

aclose() -> None

Class ToolCallProposal

A delegate's proposed call. name=None means the model declined.

Fields:

Field Type Default Description
name Optional[str]
arguments Dict[str, Any]
confidence Optional[float] None
backend str
latency_ms float

Class ToolSpec

One tool as a delegate sees it.

Fields:

Field Type Default Description
name str
description str
parameters Dict[str, Any]

Function tool_specs

Build :class:ToolSpec s from the live manager.

AbstractTool → get_schema()["parameters"] (context fields stripped, $defs preserved); ToolDefinition → input_schema. Prefers delegate_description over description.

tool_specs(tool_manager: Any, names: Sequence[str]) -> List[ToolSpec]

Parameter Type Default Description
tool_manager Any
names Sequence[str]

Returns: List[ToolSpec]

Raises:

  • KeyError — Naming the first tool the manager does not know.

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