Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.definable.ai/llms.txt

Use this file to discover all available pages before exploring further.

Run multiple steps at the same time. All steps receive the same input.
from definable.agent import Agent
from definable.agent.workflow import Workflow, Parallel, Step

tech_analyst = Agent(model="gpt-4o", instructions="Analyze technical feasibility.")
biz_analyst = Agent(model="gpt-4o", instructions="Analyze business viability.")
legal_analyst = Agent(model="gpt-4o", instructions="Analyze legal and compliance risks.")

workflow = Workflow(
    name="multi-analysis",
    steps=[
        Parallel(name="analysis", steps=[
            Step(name="technical", agent=tech_analyst),
            Step(name="business", agent=biz_analyst),
            Step(name="legal", agent=legal_analyst),
        ]),
    ],
)

result = await workflow.arun("Evaluate launching an AI-powered hiring tool")

How It Works

  1. All three analysts receive the same input.
  2. They execute concurrently (asyncio tasks).
  3. Results are combined as [step_name]: content in the output.

Limiting Concurrency

Parallel(
    name="analysis",
    steps=[...],
    max_concurrency=2,  # Only 2 steps run at a time
)

Parallel + Sequential

Combine parallel and sequential steps:
workflow = Workflow(
    name="pipeline",
    steps=[
        # Step 1: Research in parallel
        Parallel(name="research", steps=[
            Step(name="web", agent=web_researcher),
            Step(name="papers", agent=paper_reader),
        ]),
        # Step 2: Synthesize (receives both parallel outputs)
        Step(name="synthesizer", agent=synthesizer),
    ],
)