Skip to content

API Reference parrot.bots.flows.core.types

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

parrot.bots.flows.core.types

View source

Flow Primitives — Types Module.

Defines the shared type aliases, protocols, and enums used across both AgentCrew and AgentsFlow orchestration engines.

No imports from parrot.bots.* or parrot.tools.* to remain import-cycle-free.

Attribute ActionCallback

Callback type for pre/post node action hooks.

Class AgentLike

Structural protocol for any object that can act as an agent node.

Using a Protocol (rather than importing BasicAgent / AbstractBot) keeps this module import-cycle-free and allows StartNode, EndNode, and mock objects to satisfy the contract.

.. warning:: runtime_checkable limitation

``isinstance(obj, AgentLike)`` only checks for *attribute existence*,
not whether ``invoke`` is a coroutine function.  An object with a
*synchronous* ``invoke`` method will pass the check but will raise a
``TypeError`` at runtime when the engine does ``await agent.invoke(...)``.
Callers that need strict enforcement should additionally verify
``asyncio.iscoroutinefunction(obj.invoke)``.

Attributes:

Attribute Type Description
name str Human-readable agent identifier.

Method AgentLike.invoke

Process a prompt and return a result.

invoke(prompt: str, **kwargs: Any) -> Any

Parameter Type Default Description
prompt str The input prompt/question.
**kwargs Any {} Additional execution context.

Returns: Any — Agent response (type varies by agent implementation).

Attribute AgentRef

Reference to an agent — either its string name or an AgentLike object.

Attribute CrewHookCallback

Callback type for crew-level lifecycle hooks (on_complete, on_error).

Signature: (crew_name: str, result: CrewResult) -> None

The second parameter is typed as Any to avoid circular imports with parrot.models.crew.CrewResult. Hooks fire after all run_*() methods complete — both sync and async callables are supported.

Attribute DependencyResults

Mapping of dependency node IDs → their string results.

Class FlowStatus

Overall execution status for a flow/crew run.

Values match the string literals previously used in CrewResult.status.

Attribute PromptBuilder

Callable that constructs a prompt from execution context and dependency results.

The first argument is Any (not AgentContext) to avoid importing parrot.tools.agent and creating a circular dependency.

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