Skip to content

Commit 4b6e935

Browse files
gouravjshahclaude
andcommitted
docs: Update getting-started with Script node examples
- Updated "Your First Flow" section to demonstrate Script + Agent hybrid - Script nodes for data collection (no LLM tokens) - Agent node for intelligent analysis - Added Quick Reference entry for Script nodes - Split "Add Tools" section into Agent vs Script tools - Added link to AgentFlow spec in reference section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b22ce6 commit 4b6e935

File tree

1 file changed

+111
-39
lines changed

1 file changed

+111
-39
lines changed

docs/getting-started.md

Lines changed: 111 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ Both agents analyze the code in parallel and return their findings.
153153

154154
## Your First Flow (5 minutes)
155155

156-
A **Flow** chains agents together in a workflow. Let's create a Docker troubleshooting pipeline.
156+
A **Flow** chains steps together in a workflow. Flows can use:
157+
- **Agent nodes** - For intelligent analysis (uses LLM)
158+
- **Script nodes** - For deterministic operations like running commands (no LLM)
159+
160+
Let's create a Docker troubleshooting pipeline that uses Script nodes to collect data efficiently, then an Agent for intelligent analysis.
157161

158162
### Create the Flow
159163

@@ -166,80 +170,129 @@ metadata:
166170
name: docker-troubleshoot
167171

168172
spec:
169-
description: "Diagnose and fix Docker container issues"
173+
description: "Diagnose Docker issues with Script + Agent nodes"
170174

171175
nodes:
172-
# Step 1: Check status
176+
# Step 1: Get container status (Script - no LLM, fast)
173177
- id: check-status
174-
type: Agent
178+
type: Script
175179
config:
176-
inline:
177-
name: status-checker
178-
model: google:gemini-2.5-flash
179-
instructions: |
180-
Run docker ps -a to check container status.
181-
Report: running count, stopped count, any unhealthy containers.
182-
tools:
183-
- docker
184-
185-
# Step 2: Analyze logs
186-
- id: analyze-logs
187-
type: Agent
180+
script_config:
181+
tool: docker
182+
action: ps
183+
args:
184+
all: true
185+
186+
# Step 2: Get container stats (Script - no LLM)
187+
- id: get-stats
188+
type: Script
188189
config:
189-
inline:
190-
name: log-analyzer
191-
model: google:gemini-2.5-flash
192-
instructions: |
193-
For any unhealthy or exited containers, check their logs.
194-
Look for error patterns and identify root causes.
195-
tools:
196-
- docker
190+
script_config:
191+
tool: docker
192+
action: stats
197193

198-
# Step 3: Recommend fixes
199-
- id: recommend-fixes
194+
# Step 3: Get logs from exited containers (Script - shell command)
195+
- id: get-logs
196+
type: Script
197+
config:
198+
script_config:
199+
command: |
200+
docker ps -a --filter "status=exited" --format "{{.Names}}" | head -3 | while read name; do
201+
echo "=== Logs for $name ==="
202+
docker logs --tail 30 "$name" 2>&1
203+
done
204+
parse: text
205+
timeout_seconds: 30
206+
207+
# Step 4: Analyze everything with AI (Agent - uses LLM)
208+
- id: analyze
200209
type: Agent
201210
config:
202211
inline:
203-
name: fixer
212+
name: docker-analyst
204213
model: google:gemini-2.5-flash
205214
instructions: |
206-
Based on the analysis, provide specific commands to fix issues.
207-
Format: Issue → Cause → Fix command → Notes
208-
tools:
209-
- docker
215+
Analyze the Docker diagnostics and provide:
216+
1. **Status Summary**: Overview of container health
217+
2. **Issues Found**: Any problems detected
218+
3. **Root Causes**: Likely reasons for failures
219+
4. **Fix Commands**: Specific docker commands to resolve issues
220+
221+
Be concise and actionable.
222+
temperature: 0.1
223+
input: |
224+
Container Status:
225+
${check-status.output}
226+
227+
Resource Stats:
228+
${get-stats.output}
229+
230+
Logs from Exited Containers:
231+
${get-logs.output}
210232
211233
connections:
212234
- from: start
213235
to: check-status
214236
- from: check-status
215-
to: analyze-logs
216-
- from: analyze-logs
217-
to: recommend-fixes
237+
to: get-stats
238+
- from: get-stats
239+
to: get-logs
240+
- from: get-logs
241+
to: analyze
218242
```
219243
220244
### Run It
221245
222246
```bash
223247
# Diagnose your Docker environment
224248
aofctl run flow docker-troubleshoot.yaml --input "diagnose"
249+
```
250+
251+
**Why this is efficient:** Script nodes collect data without using LLM tokens. Only the final analysis step uses the AI, making the flow faster and cheaper.
252+
253+
### Script Nodes: No LLM, Just Commands
254+
255+
Script nodes run shell commands or native tools directly:
225256

226-
# Focus on a specific container
227-
aofctl run flow docker-troubleshoot.yaml --input "diagnose container nginx"
257+
```yaml
258+
# Shell command
259+
- id: get-logs
260+
type: Script
261+
config:
262+
script_config:
263+
command: docker logs --tail 50 myapp
264+
parse: lines # Split output into array
265+
266+
# Native tool (built-in support)
267+
- id: check-pods
268+
type: Script
269+
config:
270+
script_config:
271+
tool: kubectl
272+
action: get
273+
args:
274+
resource: pods
275+
namespace: default
228276
```
229277
230-
The flow executes each step in sequence, passing context between agents.
278+
**Available native tools:** `docker`, `kubectl`, `http`, `json`, `file`
279+
280+
The flow executes each step in sequence, passing context between nodes.
231281

232282
## Quick Reference
233283

234284
| Concept | What It Does | When to Use |
235285
|---------|--------------|-------------|
236-
| **Agent** | Single AI specialist | Simple tasks, one skill |
286+
| **Agent** | Single AI specialist | Simple tasks, intelligent analysis |
237287
| **Fleet** | Multiple agents in parallel | Reviews, analysis, multi-perspective tasks |
238288
| **Flow** | Sequential pipeline | Multi-step workflows, troubleshooting |
289+
| **Script Node** | Run commands (no LLM) | Data collection, CLI operations, file ops |
239290

240291
## Add Tools
241292

242-
Agents can use these built-in tools:
293+
### Agent Tools (LLM-driven)
294+
295+
Agents can use these built-in tools via the LLM:
243296

244297
```yaml
245298
spec:
@@ -253,6 +306,24 @@ spec:
253306
- http # HTTP requests
254307
```
255308

309+
### Script Node Tools (No LLM)
310+
311+
Script nodes have native tools that run without LLM involvement:
312+
313+
```yaml
314+
# In a Flow, use Script nodes for deterministic operations
315+
- id: check-pods
316+
type: Script
317+
config:
318+
script_config:
319+
tool: docker # docker, kubectl, http, json, file
320+
action: ps
321+
args:
322+
all: true
323+
```
324+
325+
**Tip:** Use Script nodes for data collection, then pass results to Agent nodes for analysis. This saves tokens and speeds up flows.
326+
256327
## Use Other Models
257328

258329
```yaml
@@ -289,6 +360,7 @@ You've learned the three core concepts. Now:
289360
### Reference
290361
- **[Agent Spec](reference/agent-spec.md)** - Complete YAML reference
291362
- **[Fleet Spec](reference/fleet-spec.md)** - Multi-agent configuration
363+
- **[AgentFlow Spec](reference/agentflow-spec.md)** - Flows, Script nodes, and more
292364
- **[aofctl CLI](reference/aofctl.md)** - All CLI commands
293365

294366
## Troubleshooting

0 commit comments

Comments
 (0)