You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
@@ -153,7 +153,11 @@ Both agents analyze the code in parallel and return their findings.
153
153
154
154
## Your First Flow (5 minutes)
155
155
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.
157
161
158
162
### Create the Flow
159
163
@@ -166,80 +170,129 @@ metadata:
166
170
name: docker-troubleshoot
167
171
168
172
spec:
169
-
description: "Diagnose and fix Docker container issues"
173
+
description: "Diagnose Docker issues with Script + Agent nodes"
170
174
171
175
nodes:
172
-
# Step 1: Check status
176
+
# Step 1: Get container status (Script - no LLM, fast)
173
177
- id: check-status
174
-
type: Agent
178
+
type: Script
175
179
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
188
189
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
197
193
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
200
209
type: Agent
201
210
config:
202
211
inline:
203
-
name: fixer
212
+
name: docker-analyst
204
213
model: google:gemini-2.5-flash
205
214
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}
210
232
211
233
connections:
212
234
- from: start
213
235
to: check-status
214
236
- 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
218
242
```
219
243
220
244
### Run It
221
245
222
246
```bash
223
247
# Diagnose your Docker environment
224
248
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:
225
256
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
228
276
```
229
277
230
-
The flow executes each step in sequence, passing context between agents.
0 commit comments