Workflows — DAG orchestration
Compose agents (and any callables) into a dependency graph. Independent steps run in parallel; dependent steps run in order. Conditions skip steps, failures cascade, and steps can retry.
from neuroagent import Agent, Workflow
researcher = Agent(provider="openai", system_prompt="You research topics thoroughly.")
writer = Agent(provider="openai", system_prompt="You write engaging prose.")
wf = Workflow("content-pipeline")
wf.add_agent_step("research", researcher, lambda ctx: f"Research: {ctx.get('topic')}")
wf.add_agent_step(
"draft", writer,
lambda ctx: f"Write a post based on:\n{ctx.result('research')}",
depends_on=["research"],
)
result = wf.run(inputs={"topic": "AI agent frameworks"})
print(result.success) # True
print(result["draft"]) # the writer's output
Plain-function steps, conditions, retries, and resume
from neuroagent.workflow import RetryPolicy
wf.add_step("flaky", do_work, retry=RetryPolicy(max_attempts=3, delay=1.0))
wf.run(inputs={...}, checkpoint={"research": "...prior result..."}) # resume
NeuroAgent AI