Skip to main content
Create a workflow where a researcher feeds into a writer.
1

Create the workflow

basic_workflow.py
import asyncio
from definable.agent import Agent
from definable.agent.workflow import Workflow, Step

researcher = Agent(
    model="gpt-4o",
    instructions="Research the given topic. Provide detailed facts and sources.",
)
writer = Agent(
    model="gpt-4o",
    instructions="Write a clear, engaging article based on the research provided.",
)

workflow = Workflow(
    name="research-pipeline",
    steps=[
        Step(name="research", agent=researcher),
        Step(name="write", agent=writer),
    ],
)

async def main():
    result = await workflow.arun("The impact of AI on healthcare")
    print(result.content)
    print(f"\nCompleted in {result.duration_ms:.0f}ms")
    print(f"Steps: {[s.step_name for s in result.step_outputs]}")

asyncio.run(main())
2

Install and run

pip install definable
python basic_workflow.py
The researcher gathers information, then the writer produces an article based on those findings.