Skip to main content
Practical examples to help you move from basic chats to repeatable workflows.

In this section

  • Workflow Snippets — small, focused YAML patterns you can copy directly
  • Use Cases — larger end-to-end workflow examples for common development tasks

Quick patterns

Simple agent loop

- id: agent_loop
  loop:
    while: size(outputs.tool_calls) > 0 && iter.iteration < inputs.max_turns
    inline:
      entry: [call_llm]
      outputs:
        tool_calls: "{{nodes.call_llm.tool_calls}}"
      nodes:
        - id: call_llm
          action: CallLLM
        - id: execute_tools
          action: ExecuteTools
          inputs:
            tool_calls: "{{nodes.call_llm.tool_calls}}"
      edges:
        - from: call_llm
          cases:
            - to: execute_tools
              condition: nodes.call_llm.tool_calls != null && size(nodes.call_llm.tool_calls) > 0

Branch on exit code

edges:
  - from: run_tests
    cases:
      - to: on_success
        condition: nodes.run_tests.exit_code == 0
      - to: on_failure
        condition: nodes.run_tests.exit_code != 0

Parallel agents

- id: impl_1
  workflow: builtin://agent
  thread:
    mode: fork
    key: impl_1

- id: impl_2
  workflow: builtin://agent
  thread:
    mode: fork
    key: impl_2

- id: join_all
  join: all
For more patterns, see Workflow Snippets. For bigger compositions, see Use Cases.