Pattern 02. Built-in Pattern Execution Playbook — Complete Guide to 4 Patterns
Learning Objectives
After completing this tutorial, you will be able to:
- Execute the 4 built-in patterns (report.evidence, code.tdd, ops.triage, research.broad_to_narrow) hands-on
- Understand each pattern's node flow and handle HITL approval procedures
- Resume a paused run during execution
- Locate and verify execution result artifacts
Prerequisites
01_concepts.mdcompleted (understanding of pattern concepts)- euleragent initialization complete (
euleragent init) - Agent creation complete (
euleragent agent new my-agent) - Two terminals ready (one for execution + one for approval)
# Verify agent
euleragent agent list
# Check built-in pattern list
euleragent pattern list
Pattern 1: report.evidence — Evidence-Based Report Writing
Pattern Description
A pattern that collects evidence through web search, writes a draft, and evaluates quality with a Judge. HITL approval occurs during the search stage.
Node Flow Diagram
┌─────────────────────────────────────────────────────────────────┐
│ report.evidence Pattern Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ [outline] │
│ │ Write report outline (llm/execute) │
│ │ when: true │
│ ▼ │
│ [gather] ◄── HITL PAUSE (web.search approval required) │
│ │ Generate web search proposals (llm/plan, force_tool=web.search) │
│ │ when: approvals_resolved │
│ ▼ │
│ [draft] │
│ │ Write draft from collected evidence (llm/execute) │
│ │ when: true │
│ ▼ │
│ [evaluate] ──────────────── when: judge.route == finalize ─────┐
│ │ Quality evaluation (judge/evaluator_v1) │
│ │ when: judge.route == revise │
│ ▼ │
│ [revise] │
│ │ Improve draft (llm/execute) │
│ │ when: true │
│ └────────────────────────► [evaluate] (loop, max: 3 times) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ [FINALIZE] Save report.md │◄──┘
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Step 1: Validate Pattern
euleragent pattern validate report.evidence
Expected output:
Validating pattern: report.evidence
Stage 1 (Schema) PASS
Stage 2 (Structural) PASS
Stage 3 (IR Analysis) PASS
Validation complete: 0 errors, 0 warnings
Step 2: Run the Pattern
euleragent pattern run report.evidence my-agent \
--task "LangChain, CrewAI, AutoGen 경쟁사 분석 보고서 작성" \
--project default
Expected output (paused at gather node):
[run:a3f2b1c0] Starting pattern: report.evidence
[run:a3f2b1c0] Agent: my-agent | Task: LangChain, CrewAI, AutoGen 경쟁사 분석...
✓ outline Completed — Report outline with 6 sections generated
⏸ gather PAUSED — Waiting for HITL approval
Approval required. Run the following to review:
euleragent approve list --run-id a3f2b1c0
Resume after approval:
euleragent pattern resume a3f2b1c0 --execute
Step 3: Check Approval Items
euleragent approve list --run-id a3f2b1c0
Expected output:
Pending Approvals for run: a3f2b1c0
─────────────────────────────────────────────────
Node: gather
#1 web.search "LangChain framework features 2024"
#2 web.search "CrewAI multi-agent framework overview"
#3 web.search "AutoGen Microsoft agent framework comparison"
#4 web.search "AI agent framework benchmark 2024"
#5 web.search "LangChain vs CrewAI vs AutoGen comparison"
5 tool calls pending approval.
Step 4: Batch Approve and Execute
euleragent approve accept-all --run-id a3f2b1c0 --execute
Expected output:
Accepted 5 tool calls for run: a3f2b1c0
Executing approved tool calls...
web.search "LangChain framework features 2024" OK (12 results)
web.search "CrewAI multi-agent framework overview" OK (8 results)
web.search "AutoGen Microsoft agent framework comparison" OK (11 results)
web.search "AI agent framework benchmark 2024" OK (9 results)
web.search "LangChain vs CrewAI vs AutoGen comparison" OK (15 results)
All tool calls executed. Resuming pattern run...
Step 5: Resume Pattern
euleragent pattern resume a3f2b1c0 --execute
Expected output:
[run:a3f2b1c0] Resuming from: gather → draft
✓ gather Completed — 5 web searches executed
✓ draft Completed — 2,847 words draft generated
✓ evaluate Completed — score: 0.78 → route: revise
✓ revise Completed — draft improved, added citations
✓ evaluate Completed — score: 0.91 → route: finalize
✓ finalize Completed — report.md saved
Run a3f2b1c0 completed successfully.
Artifact: .euleragent/runs/a3f2b1c0/artifacts/report.md
Step 6: Check Results
# Artifact path
cat .euleragent/runs/a3f2b1c0/artifacts/report.md
# Check execution logs
euleragent logs --run-id a3f2b1c0
# Check event stream
cat .euleragent/runs/a3f2b1c0/pattern_events.jsonl | head -20
Artifact directory structure:
.euleragent/runs/a3f2b1c0/
├── input.json # Execution input (task, agent, pattern)
├── messages.jsonl # Full LLM message history
├── tool_calls.jsonl # All tool call records
├── approvals.jsonl # HITL approval records
├── pattern_events.jsonl # Pattern state transition events
└── artifacts/
└── report.md # Final result
Pattern 2: code.tdd — Test-Driven Development
Pattern Description
Implements TDD through a design → write tests (HITL) → implement → run tests (HITL) → evaluate → fix/complete flow. HITL occurs for file writing and shell execution.
Node Flow Diagram
┌─────────────────────────────────────────────────────────────────┐
│ code.tdd Pattern Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ [design] │
│ │ API design and test case planning (llm/execute) │
│ │ when: true │
│ ▼ │
│ [write_tests] ◄── HITL PAUSE (file.write approval required) │
│ │ Propose test file writing (llm/plan, force_tool=file.write) │
│ │ when: approvals_resolved │
│ ▼ │
│ [implement] │
│ │ Write implementation code (llm/execute) │
│ │ when: true │
│ ▼ │
│ [run_tests] ◄── HITL PAUSE (shell.exec approval required) │
│ │ Propose test execution (llm/plan, force_tool=shell.exec) │
│ │ when: approvals_resolved │
│ ▼ │
│ [evaluate] ─────────────── when: judge.route == finalize ──────┐
│ │ Code quality evaluation (judge/evaluator_v1) │
│ │ when: judge.route == fix │
│ ▼ │
│ [fix] │
│ │ Bug fix (llm/execute) │
│ └────────────────────────► [run_tests] (loop, max: 3 times) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ [FINALIZE] Save implementation.py + tests.py │◄──┘
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Step 1: Validate and Run
euleragent pattern validate code.tdd
euleragent pattern run code.tdd my-agent \
--task "Python으로 add(a, b) 함수 TDD로 구현. 엣지 케이스(None, 문자열, 오버플로우) 포함." \
--project default
Expected output (first pause at write_tests):
[run:b7e4d2f1] Starting pattern: code.tdd
✓ design Completed — API spec and 8 test cases planned
⏸ write_tests PAUSED — Waiting for HITL approval (file.write)
Approval required:
euleragent approve list --run-id b7e4d2f1
Step 2: Approve Test File Writing
euleragent approve list --run-id b7e4d2f1
Expected output:
Pending Approvals for run: b7e4d2f1
─────────────────────────────────────────────────
Node: write_tests
#1 file.write path=tests/test_calculator.py
Content preview:
import pytest
from calculator import add
def test_add_integers():
assert add(1, 2) == 3
def test_add_with_none():
with pytest.raises(TypeError):
add(None, 1)
[... 47 more lines]
1 file write pending approval.
euleragent approve accept-all --run-id b7e4d2f1 --execute
euleragent pattern resume b7e4d2f1 --execute
Second pause (at run_tests):
[run:b7e4d2f1] Resuming from: write_tests → implement
✓ write_tests Completed — tests/test_calculator.py written
✓ implement Completed — calculator.py implemented
⏸ run_tests PAUSED — Waiting for HITL approval (shell.exec)
Step 3: Approve Test Execution
euleragent approve list --run-id b7e4d2f1
#1 shell.exec cmd="python -m pytest tests/test_calculator.py -v"
cwd="./"
1 shell command pending approval.
euleragent approve accept-all --run-id b7e4d2f1 --execute
euleragent pattern resume b7e4d2f1 --execute
Expected final output:
✓ run_tests Completed — pytest: 8 passed, 0 failed
✓ evaluate Completed — score: 0.92 → route: finalize
✓ finalize Completed
Artifacts:
.euleragent/runs/b7e4d2f1/artifacts/implementation.py
.euleragent/runs/b7e4d2f1/artifacts/tests.py
Pattern 3: ops.triage — Operations Ticket Triage
Pattern Description
A short, fast pattern that classifies operations tickets, writes a resolution draft (HITL), and evaluates quality. It operates using only LLM knowledge without web search.
Node Flow Diagram
┌─────────────────────────────────────────────────────────────────┐
│ ops.triage Pattern Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ [classify] │
│ │ Classify ticket and determine priority (llm/execute) │
│ │ when: true │
│ ▼ │
│ [draft] ◄── HITL PAUSE (file.write approval required) │
│ │ Write resolution draft (llm/plan, force_tool=file.write) │
│ │ when: approvals_resolved │
│ ▼ │
│ [evaluate] ──────────── when: judge.route == finalize ─────────┐
│ │ Evaluate resolution quality (judge/evaluator_v1) │
│ │ when: judge.route == revise │
│ ▼ │
│ [revise] │
│ │ Improve resolution (llm/execute) │
│ └────────────────────────► [evaluate] (loop, max: 2 times) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ [FINALIZE] Save triage_report.md │◄──┘
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Step 1: Validate and Run
euleragent pattern validate ops.triage
euleragent pattern run ops.triage my-agent \
--task "고객 지원 티켓: 로그인 타임아웃 오류 발생. 사용자 보고: '30분마다 자동 로그아웃됨, 업무 중단'. 시스템: Django + Redis 세션." \
--project default
Expected output (paused at draft):
[run:c1a8e3b5] Starting pattern: ops.triage
✓ classify Completed
Priority: HIGH | Category: Authentication/Session
Impact: Medium (multiple users affected)
⏸ draft PAUSED — Waiting for HITL approval (file.write)
Step 2: Approve Draft File
euleragent approve list --run-id c1a8e3b5
#1 file.write path=triage/login_timeout_resolution.md
Content preview:
# 티켓 해결책: 로그인 타임아웃 오류
## 원인 분석
Django 세션 타임아웃 설정이 기본값(30분)으로 설정되어 있음
Redis 세션 백엔드 연결 불안정 가능성
## 즉시 조치
1. settings.py SESSION_COOKIE_AGE 값 확인
[... 32 more lines]
euleragent approve accept-all --run-id c1a8e3b5 --execute
euleragent pattern resume c1a8e3b5 --execute
Expected final output:
✓ draft Completed — triage/login_timeout_resolution.md written
✓ evaluate Completed — score: 0.89 → route: finalize
✓ finalize Completed
Artifact: .euleragent/runs/c1a8e3b5/artifacts/triage_report.md
Run time: 47 seconds
Pattern 4: research.broad_to_narrow — Broad-to-Deep Research
Pattern Description
A research pattern that first investigates broadly (web.search), clusters topics, identifies gaps for deep investigation, and synthesizes findings. The Judge sends the flow back to narrow_search if further focused investigation is needed.
Node Flow Diagram
┌─────────────────────────────────────────────────────────────────┐
│ research.broad_to_narrow Pattern Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ [broad_search] ◄── HITL PAUSE (web.search, 5+ queries) │
│ │ Broad web search (llm/plan, force_tool=web.search) │
│ │ when: approvals_resolved │
│ ▼ │
│ [cluster_gaps] │
│ │ Topic clustering, gap identification (llm/execute) │
│ │ when: true │
│ ▼ │
│ [narrow_search] ◄── HITL PAUSE (web.search, gap-focused) ◄───┐
│ │ Deep search targeting gaps (llm/plan, force_tool=web.search) │
│ │ when: approvals_resolved │
│ ▼ │
│ [synthesize] │
│ │ Synthesize research results (llm/execute) │
│ │ when: true │
│ ▼ │
│ [evaluate] ───── when: judge.route == finalize ────────────────┐
│ │ Evaluate research completeness (judge/evaluator_v1) │
│ ├── when: judge.route == narrow_search ─────────────────────►┘
│ │ (further focused investigation needed) │
│ │ when: judge.route == refine │
│ ▼ │
│ [refine] │
│ │ Improve synthesis (llm/execute) │
│ └────────────────────────► [evaluate] (loop, max: 3 times) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ [FINALIZE] Save research_report.md │◄──┘
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Step 1: Validate and Run
euleragent pattern validate research.broad_to_narrow
euleragent pattern run research.broad_to_narrow my-agent \
--task "AI 에이전트의 장기기억 메커니즘 연구. RAG, 벡터 DB, 메모리 압축, 에피소딕 메모리를 포함할 것." \
--project default
Expected output (first pause at broad_search):
[run:d4f9c2a7] Starting pattern: research.broad_to_narrow
⏸ broad_search PAUSED — Waiting for HITL approval (web.search × 7)
Step 2: Approve Broad Search
euleragent approve list --run-id d4f9c2a7
#1 web.search "AI agent long-term memory mechanisms 2024"
#2 web.search "RAG retrieval augmented generation agent memory"
#3 web.search "vector database agent memory LlamaIndex LangChain"
#4 web.search "episodic memory artificial intelligence agents"
#5 web.search "memory compression summarization LLM agents"
#6 web.search "agent memory benchmark evaluation"
#7 web.search "cognitive architecture memory AI 2024"
7 tool calls pending approval.
euleragent approve accept-all --run-id d4f9c2a7 --execute
euleragent pattern resume d4f9c2a7 --execute
Second pause at narrow_search:
✓ broad_search Completed — 7 searches, 73 results collected
✓ cluster_gaps Completed — 4 clusters, 3 gaps identified
Gaps: [Specific comparison of memory compression algorithms, Real-time memory updates, Multi-agent memory sharing]
⏸ narrow_search PAUSED — Waiting for HITL approval (web.search × 5)
euleragent approve accept-all --run-id d4f9c2a7 --execute
euleragent pattern resume d4f9c2a7 --execute
Expected final output:
✓ narrow_search Completed — 5 targeted searches
✓ synthesize Completed — 4,312 words synthesis generated
✓ evaluate Completed — score: 0.88 → route: finalize
✓ finalize Completed
Artifact: .euleragent/runs/d4f9c2a7/artifacts/research_report.md
Streaming Mode Execution
Using the --stream flag, you can monitor each node's progress in real time.
euleragent pattern run research.broad_to_narrow my-agent \
--task "AI 에이전트의 장기기억 메커니즘 연구" \
--project default \
--stream
Streaming output example:
[event] pattern.start {pattern: research.broad_to_narrow, run_id: e5a1d3c9}
[event] node.start {node: broad_search, kind: llm}
[event] node.hitl {node: broad_search, pending: 7}
[event] node.pause {node: broad_search, reason: hitl_pending}
...
[event] hitl.resolved {node: broad_search, accepted: 7, rejected: 0}
[event] node.resume {node: broad_search}
[event] tool.call {tool: web.search, query: "AI agent long-term memory..."}
[event] tool.result {tool: web.search, results: 12}
...
[event] node.complete {node: broad_search}
[event] edge.traverse {from: broad_search, to: cluster_gaps, when: approvals_resolved}
[event] node.start {node: cluster_gaps, kind: llm}
Common Operations Commands
Checking run-id
# Recent run list
euleragent runs list
# Check specific run status
euleragent runs status <run-id>
# List only paused runs
euleragent runs list --status paused
Individual Approve/Reject
Instead of batch approval, process items individually:
# Accept specific items
euleragent approve accept --run-id <id> --item 1 --item 3
# Reject specific items (with reason)
euleragent approve reject --run-id <id> --item 2 --reason "Low relevance query"
# Accept and execute immediately
euleragent approve accept --run-id <id> --item 1 --execute
Cancel Execution
euleragent runs cancel <run-id>
Common Errors and Solutions
Error 1: Agent not found
Error: Agent 'my-agent' not found in workspace
Solution: Create the agent first with euleragent agent new my-agent.
Error 2: run-id expired
Error: Run 'a3f2b1c0' not found or expired
Solution: Check the active run list with euleragent runs list. A run that has been in a paused state for too long may expire.
Error 3: Running resume without --execute
euleragent pattern resume a3f2b1c0
Run a3f2b1c0 is ready to resume. Add --execute to actually run.
(Dry-run mode: showing what would happen next)
Next step: draft → evaluate (when: true)
Running without --execute enters dry-run mode. Add --execute to actually run.
Error 4: Resuming an already completed run
Error: Run 'a3f2b1c0' is already in 'completed' state. Cannot resume.
Solution: Start a new execution or check the status with euleragent runs list.
Next Steps
You have now executed all 4 built-in patterns. It is time to create your own custom patterns.
- Next tutorial: 03_simple_linear.md — Write the simplest 3-node linear pattern from scratch
- Understanding Judge loops: 04_judge_and_loop.md — Design an evaluate-revise loop yourself