Skip to content

Cookbook

Complete, runnable multi-agent orchestration examples — each one a self-contained recipe you can copy, paste, and run. Every example shows the exact pip install, the full code, and the expected output.

Filter the recipes below by domain, design pattern, or package — pick any combination (multiple picks in one group match any; across groups they match all).

Ci Cd Validation Beginner

Validate a blueprint and semantically diff it against main in a GitHub Actions PR check

Contract Testing Beginner

Run pyagent-blueprint's built-in MockLLM contract tests in CI before any real model call

Governance In Yaml Intermediate

Declare SLA/budget and recovery policy in YAML; see the stable diagnostic a non-supporting adapter reports

Customer Onboarding Workflow Intermediate

Verification, setup, FAQ, and success roles onboard a new customer end to end

graph TD
    verification[verification]
    account_setup[account_setup]
    faq[faq]
    success[success]

Support Router Advanced

Classify tickets → route to specialists → escalate to a human

graph TD
    supervisor[supervisor]
    billing_fast[billing_fast]
    billing_deep[billing_deep]
    tech_fast[tech_fast]
    tech_deep[tech_deep]
    account_fast[account_fast]
    account_deep[account_deep]
    escalation_writer[escalation_writer]
    supervisor -->|supervisor| billing_deep
    billing_deep -->|supervisor| tech_deep
    tech_deep -->|supervisor| account_deep
    account_deep -->|supervisor| escalation_writer
    supervisor -->|billing| billing_deep
    supervisor -->|technical| tech_deep
    supervisor -->|account| account_deep
    supervisor -->|escalate| escalation_writer

Analytics Task Decomposer Intermediate

Orchestrator breaks an analytics request into query, transform, and chart workers

graph TD
    analytics_lead[analytics_lead]
    query[query]
    transform[transform]
    chart[chart]

SQL Analyst Intermediate

Reason-act loop that writes and runs SQL to answer questions

graph TD
    sql_analyst[sql_analyst]

Incident Triage Intermediate

Stage pipeline that triages incidents with human sign-off

graph TD
    log_analyst[log_analyst]
    root_cause[root_cause]
    remediation[remediation]
    runbook_writer[runbook_writer]

Product Launch Planner Intermediate

Orchestrator splits a launch into pricing/copy/SEO/inventory subtasks for workers

graph TD
    launch_lead[launch_lead]
    pricing[pricing]
    copywriter[copywriter]
    seo[seo]
    inventory[inventory]

Essay Grading by Consensus Intermediate

Independent graders score against a rubric; a majority vote sets the grade

graph TD
    grader_openai[grader_openai]
    grader_anthropic[grader_anthropic]
    grader_gemini[grader_gemini]
    grammar_grader[grammar_grader]

AML Transaction Monitoring Advanced

Screen → score → enrich pipeline gates high-risk transactions to a human reviewer

graph TD
    rule_screener[rule_screener]
    risk_scorer[risk_scorer]
    enrichment[enrichment]
    sar_drafter[sar_drafter]

ESG Report Analyzer Advanced

Orchestrator dispatches ratings, disclosure, and SFDR-scoring workers into an ESG summary

graph TD
    esg_lead[esg_lead]
    ratings[ratings]
    disclosure_extractor[disclosure_extractor]
    sfdr_scorer[sfdr_scorer]
    controversy[controversy]

Earnings Call Analyzer Intermediate

A self-reflecting agent iterates on an earnings transcript until the analysis clears a quality bar

graph TD
    earnings_analyst[earnings_analyst]

Loan Origination Workflow Advanced

Document → income → credit → approval agents pass an application along a chain

graph TD
    document_collection[document_collection]
    income_verification[income_verification]
    credit_scoring[credit_scoring]
    approval[approval]

Loan Underwriting Committee Advanced

Approve and decline advocates debate an application; a senior underwriter decides

graph TD
    approve_advocate[approve_advocate]
    decline_advocate[decline_advocate]
    senior_underwriter[senior_underwriter]

Portfolio Review Intermediate

Analyst panel with an evaluator-optimizer quality gate

graph TD
    router[router]
    equities[equities]
    rates[rates]
    risk[risk]
    writer[writer]
    reviewer[reviewer]
    router -->|supervisor| equities
    equities -->|supervisor| rates
    rates -->|supervisor| risk
    router -->|equity| equities
    router -->|fixed_income| rates
    router -->|risk| risk
    writer -->|evaluator_optimizer| reviewer

Robo-Advisor Onboarding Intermediate

Intake, risk, suitability, and planning roles rotate to build a client investment plan

graph TD
    intake[intake]
    risk_profiler[risk_profiler]
    suitability[suitability]
    planner[planner]

Trading Signal Desk Advanced

Momentum, mean-reversion, and sentiment agents fan out then aggregate into a trade idea

graph TD
    momentum[momentum]
    mean_reversion[mean_reversion]
    sentiment[sentiment]
    signal_aggregator[signal_aggregator]

Wealth Rebalancing Crew Intermediate

Risk → market scan → allocation → compliance pipeline proposes a rebalance

graph TD
    risk_profiler[risk_profiler]
    market_scanner[market_scanner]
    allocation_strategist[allocation_strategist]
    compliance_checker[compliance_checker]

Emergent NPC World Advanced

NPC agents read/write a shared world-state blackboard for emergent behavior

graph TD
    explorer[explorer]
    builder[builder]
    trader[trader]
    chronicler[chronicler]

Policy Briefing Pipeline Advanced

A director delegates to department leads and analysts, then synthesizes a brief

graph TD
    policy_director[policy_director]
    economics_lead[economics_lead]
    fiscal_analyst[fiscal_analyst]
    labour_analyst[labour_analyst]
    legal_lead[legal_lead]
    statute_analyst[statute_analyst]
    rights_analyst[rights_analyst]

CV Screener Intermediate

Parallel reviewers score a CV; aggregate into one verdict

graph TD
    skills[skills]
    experience[experience]
    collaboration[collaboration]
    panel[panel]

Clinical Summary Intermediate

Summarize clinical notes, then self-critique for accuracy

graph TD
    extractor[extractor]
    drafter[drafter]
    summary_reviewer[summary_reviewer]

Contract Review Intermediate

Draft + independent reviewer loop over contract clauses

graph TD
    counsel[counsel]
    partner[partner]
    counsel -->|cross_reflection| partner

Regulatory Compliance Checker Advanced

A director delegates obligation and control teams, then synthesizes a gap analysis

graph TD
    compliance_director[compliance_director]
    obligations_lead[obligations_lead]
    controls_lead[controls_lead]
    requirement_extractor[requirement_extractor]
    scope_analyst[scope_analyst]
    policy_mapper[policy_mapper]
    evidence_checker[evidence_checker]

Campaign Planner Beginner

Parallel channel ideas aggregated into one campaign plan

graph TD
    email[email]
    social[social]
    blog[blog]
    campaign_director[campaign_director]

Writers' Room Intermediate

Showrunner, writer, editor, and continuity roles collaborate on an episode outline

graph TD
    showrunner[showrunner]
    staff_writer[staff_writer]
    script_editor[script_editor]
    continuity[continuity]
    network_exec[network_exec]

Property Valuation Stack Intermediate

Data → comparables → narrative layers produce a valuation report

graph TD
    property_facts[property_facts]
    market_facts[market_facts]
    comps[comps]
    adjustments[adjustments]
    report_writer[report_writer]
    reviewer[reviewer]

Literature Review Team Advanced

A lead delegates discovery and synthesis sub-teams to produce a cited review

graph TD
    research_lead[research_lead]
    discovery_lead[discovery_lead]
    synthesis_lead[synthesis_lead]
    source_finder[source_finder]
    relevance_triage[relevance_triage]
    findings_extractor[findings_extractor]
    citation_writer[citation_writer]

Research Assistant Advanced

Gather sources, debate, synthesize, and cite

graph TD
    web_agent[web_agent]
    academic_agent[academic_agent]
    industry_agent[industry_agent]
    optimist[optimist]
    sceptic[sceptic]
    judge[judge]
    synthesizer[synthesizer]

Lead Qualifier Intermediate

Score and route inbound leads to the right play

graph TD
    scorer[scorer]
    account_exec[account_exec]
    nurture[nurture]
    cold_hold[cold_hold]
    scorer -->|supervisor| account_exec
    account_exec -->|supervisor| nurture
    nurture -->|supervisor| cold_hold
    scorer -->|hot| account_exec
    scorer -->|warm| nurture
    scorer -->|cold| cold_hold

Peer-Review Mesh Advanced

Reviewers critique a manuscript in a mesh, reconciling notes across rounds

graph TD
    methodology_reviewer[methodology_reviewer]
    novelty_reviewer[novelty_reviewer]
    clarity_reviewer[clarity_reviewer]
    stats_reviewer[stats_reviewer]

Alert Triage Intermediate

Triage security alerts; escalate true positives to a human

graph TD
    enricher[enricher]
    correlator[correlator]
    classifier[classifier]
    case_writer[case_writer]

Fraud Investigation Assistant Advanced

A reason-act agent calls transaction, anomaly, and sanctions tools to build a case

graph TD
    fraud_analyst[fraud_analyst]

Code Review Advanced

Iterative review + security scan with a human gate

graph TD
    code_agent[code_agent]
    review_agent[review_agent]
    security_agent[security_agent]
    escalation_agent[escalation_agent]
    code_agent -->|cross_reflection| review_agent

Software Startup Simulation Advanced

PM, Architect, Engineer, and QA role-play an idea into PRD, design, code, and tests

graph TD
    product_manager[product_manager]
    architect[architect]
    engineer[engineer]
    qa[qa]

Trip-Planning Swarm Advanced

Self-organizing agents negotiate flights, lodging, and activities into an itinerary

graph TD
    flights[flights]
    lodging[lodging]
    activities[activities]
    budget[budget]
    local_guide[local_guide]