Skip to main content
A triage agent classifies the user’s intent, then conditional edges activate exactly one of two downstream handlers. The other node is silently skipped. Only the matching branch executes per run.

What it demonstrates

  • Conditional edges with when: expressions
  • Writing to a nested working.* path (working.triage.intent)
  • Safe expression evaluation — only working and output are in scope
  • Branching without duplicating agent definitions

Run it

Workflow

docs/cookbook/conditional-pipeline/workflow.yaml

How branching works

After triage writes its one-word label to working.triage.intent, the executor evaluates both outgoing when: expressions. Only the matching node runs. If neither expression matches (e.g. the LLM returns an unexpected label), both nodes are skipped and output.reply is never written.
when: expressions run in a sandboxed namespace. Only working and output are available — no built-ins, no imports. Evaluation errors are treated as False and the edge is silently skipped.

Graph

Next steps

Adversarial Pair

Two agents take opposing sides; a judge scores the debate.

YAML Reference

Full edge and when: expression syntax.