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())