Real work doesn't run
in a straight line.
It loops.
DAGs only go forward. cycgraph loops back — agents retry on feedback, route on the fly, evolve in parallel, and pause for a human mid-run. That's the Cyclic State Graph: durable, auditable, zero-trust.
A loop is just one edge, pointing back.
Declare nodes, edges, and conditions as plain config — no subclasses, no callback spaghetti. Point a single edge backward and you have a loop. The runtime owns state, persistence, security, and streaming; you just describe the shape.
- Durable execution
- Every action is persisted. Runs survive crashes and replay straight from the event log.
- Zero-trust
- Agents see only their keys. External data is taint-tracked; MCP servers are allowlisted.
- Budget guardrails
- Hard caps on tokens, cost, iterations, and wall-clock — enforced by the engine, not by you.
- Observability
- OpenTelemetry traces, structured events, and token-level streaming, out of the box.
import {
GraphRunner,
createGraph,
createWorkflowState,
} from '@cycgraph/orchestrator';
// Agents are data, not classes.
const graph = createGraph({
name: 'review-loop',
start_node: 'draft',
end_nodes: ['done'],
nodes: [
{ id: 'draft', type: 'agent', agent_id: WRITER },
{ id: 'critic', type: 'agent', agent_id: REVIEWER },
{ id: 'route', type: 'supervisor', agent_id: LEAD },
],
edges: [
{ from: 'draft', to: 'critic' },
{ from: 'critic', to: 'route' },
// the cycle: loop back until the critic is satisfied
{ from: 'route', to: 'draft', when: 'needs_work' },
{ from: 'route', to: 'done', when: 'approved' },
],
});
const runner = new GraphRunner(
graph,
createWorkflowState({ workflow_id: 'r1', goal: 'Ship it' }),
);
for await (const event of runner.stream()) {
console.log(event.type);
} Nine patterns, built in. Twelve node types to compose your own.
Supervisor
An LLM router delegates, reviews the result, and re-delegates until the work is done.
Read →Evolution (DGM)
Population-based Darwinian selection: run N candidates, score them, breed the winner.
Read →Reflection
Distill lessons from a run into atomic facts that future runs retrieve and reuse.
Read →Self-Annealing
Iterative refinement on a cooling temperature schedule — explore, then converge.
Read →Swarm
Parallel agents collaborating over one shared state blackboard.
Read →Map-Reduce
Fan out across a workload, process in parallel, fan back in to a single result.
Read →Human-in-the-Loop
Pause for human input and resume from a durable checkpoint — hours or days later.
Read →Voting / Consensus
Sample many agents on the same task in parallel, then aggregate to a consensus answer.
Read →Verifier
A quality gate — LLM judge, expression, or JSONPath assertion — that routes on pass/fail.
Read →