Skip to content

API Reference parrot.bots.flows.core.storage.synthesis

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

parrot.bots.flows.core.storage.synthesis

View source

Flow Primitives — SynthesisMixin + synthesize_results util.

Copied from parrot.bots.flow.storage.synthesis into the shared core storage location. Relative imports updated for the new package depth.

Accepts both CrewResult and FlowResult via duck-typing: only the .agents (iterable of info objects) and .responses (dict) attributes are used. Full migration to FlowResult will happen in Spec 2.

Alias CrewResult

Re-exported from parrot.models.crew.CrewResult.

Alias FlowContext

Re-exported from parrot.bots.flows.core.context.FlowContext.

Alias FlowResult

Re-exported from parrot.bots.flows.core.result.FlowResult.

Attribute SYNTHESIS_PROMPT

Class SynthesisMixin

Mixin that adds LLM-based result synthesis to crew/flow orchestrators.

Requires the host class to have a logger attribute. The llm client is passed explicitly to avoid hard-coupling to a specific self._llm attribute.

Function synthesize_results

LLM-summarize all agent responses collected in a FlowResult.

This is the single source of truth for synthesis used by both:

  • AgentsFlow.run_flow(on_complete=[synthesize_results]) hooks.
  • SynthesisNode.execute() for in-graph summarization (TASK-1066).

The function mirrors SynthesisMixin._synthesize_results's prompt- building and LLM-call logic, adapted for the new-style context-based API.

synthesize_results(ctx: 'FlowContext', result: 'FlowResult', *, max_tokens: int = 8192, temperature: float = 0.1, user_id: Optional[str] = None, session_id: Optional[str] = None) -> str

Parameter Type Default Description
ctx 'FlowContext' The current flow execution context. Must have a synthesis_client attribute that is an AbstractClient- compatible object (has ask(prompt=...) -> response).
result 'FlowResult' The FlowResult (or duck-type) whose .responses dict provides per-node results to synthesize.
max_tokens int 8192 Maximum tokens for the LLM response.
temperature float 0.1 LLM sampling temperature.
user_id Optional[str] None Optional user identifier forwarded to the LLM.
session_id Optional[str] None Optional session identifier forwarded to the LLM.

Returns: str — Synthesized summary string.

Raises:

  • RuntimeError — If ctx.synthesis_client is None or absent.

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