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
Copy file name to clipboardExpand all lines: README.md
+33-12Lines changed: 33 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,17 +123,41 @@ Invoke OpenCode tools:
123
123
```
124
124
125
125
### Agent Step
126
-
Prompt an LLM:
126
+
Invoke a named OpenCode agent or prompt an LLM directly:
127
+
128
+
**Named Agent (recommended):**
129
+
```json
130
+
{
131
+
"id": "security-review",
132
+
"type": "agent",
133
+
"agent": "security-reviewer",
134
+
"prompt": "Review this code for security issues:\n\n{{steps.read_file.result}}",
135
+
"maxTokens": 1000
136
+
}
137
+
```
138
+
139
+
This invokes a pre-defined OpenCode agent by name. The agent's system prompt, model, and other settings are configured in OpenCode's agent definitions.
140
+
141
+
**Inline LLM (fallback):**
127
142
```json
128
143
{
129
144
"id": "generate-changelog",
130
145
"type": "agent",
131
146
"prompt": "Generate a changelog for version {{inputs.version}}",
132
-
"model": "gpt-4",
147
+
"system": "You are a technical writer.",
133
148
"maxTokens": 1000
134
149
}
135
150
```
136
151
152
+
This makes a direct LLM call with an optional system prompt. Note that `model` selection may not be supported by the plugin system - the configured default model will be used.
153
+
154
+
| Option | Type | Description |
155
+
|--------|------|-------------|
156
+
|`agent`|`string`| Name of a pre-defined OpenCode agent to invoke |
157
+
|`prompt`|`string`| The prompt to send (required, supports interpolation) |
158
+
|`system`|`string`| System prompt for inline LLM calls (ignored if `agent` is specified) |
159
+
|`maxTokens`|`number`| Maximum tokens for response |
160
+
137
161
### Suspend Step
138
162
Pause for human input:
139
163
```json
@@ -381,33 +405,29 @@ This example chains multiple specialized agents to review code from different pe
381
405
{
382
406
"id": "security_review",
383
407
"type": "agent",
384
-
"system": "You are a security expert. Identify vulnerabilities, injection risks, and auth issues. Be concise.",
408
+
"agent": "security-reviewer",
385
409
"prompt": "Review this code for security issues:\n\n{{steps.read_file.result}}",
386
-
"model": "anthropic:claude-sonnet-4-20250514",
387
410
"after": ["read_file"]
388
411
},
389
412
{
390
413
"id": "perf_review",
391
414
"type": "agent",
392
-
"system": "You are a performance engineer. Identify bottlenecks, memory leaks, and optimization opportunities. Be concise.",
415
+
"agent": "performance-reviewer",
393
416
"prompt": "Review this code for performance issues:\n\n{{steps.read_file.result}}",
394
-
"model": "anthropic:claude-sonnet-4-20250514",
395
417
"after": ["read_file"]
396
418
},
397
419
{
398
420
"id": "quality_review",
399
421
"type": "agent",
400
-
"system": "You are a senior developer. Review for readability, maintainability, and best practices. Be concise.",
422
+
"agent": "quality-reviewer",
401
423
"prompt": "Review this code for quality issues:\n\n{{steps.read_file.result}}",
402
-
"model": "anthropic:claude-sonnet-4-20250514",
403
424
"after": ["read_file"]
404
425
},
405
426
{
406
427
"id": "synthesize",
407
428
"type": "agent",
408
-
"system": "You are a techlead. Synthesize code reviews into a prioritized action list grouped by severity.",
429
+
"agent": "tech-lead",
409
430
"prompt": "Combine these reviews into a single report:\n\n## Security\n{{steps.security_review.response}}\n\n## Performance\n{{steps.perf_review.response}}\n\n## Quality\n{{steps.quality_review.response}}",
@@ -419,15 +439,16 @@ This example chains multiple specialized agents to review code from different pe
419
439
{
420
440
"id": "generate_fixes",
421
441
"type": "agent",
422
-
"system": "You are a codefixer. Output ONLY the corrected code, no explanations.",
442
+
"agent": "code-fixer",
423
443
"prompt": "Fix the critical and high severity issues:\n\nOriginal:\n{{steps.read_file.result}}\n\nIssues:\n{{steps.synthesize.response}}",
424
-
"model": "anthropic:claude-sonnet-4-20250514",
425
444
"after": ["approve_fixes"]
426
445
}
427
446
]
428
447
}
429
448
```
430
449
450
+
> **Note**: This example assumes you have agents named `security-reviewer`, `performance-reviewer`, `quality-reviewer`, `tech-lead`, and `code-fixer` configured in OpenCode. Alternatively, you can use inline LLM calls with `system` prompts instead of named agents.
Copy file name to clipboardExpand all lines: examples/code-review.json
+6-20Lines changed: 6 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,7 @@
5
5
"version": "1.0.0",
6
6
"tags": ["review", "agents", "quality"],
7
7
"inputs": {
8
-
"file": {
9
-
"type": "string",
10
-
"description": "File path to review",
11
-
"required": true
12
-
}
8
+
"file": "string"
13
9
},
14
10
"steps": [
15
11
{
@@ -25,40 +21,32 @@
25
21
"id": "security_review",
26
22
"type": "agent",
27
23
"description": "Security vulnerability analysis",
28
-
"system": "You are a security expert. Identify vulnerabilities, injection risks, authentication issues, and data exposure. Be concise and specific.",
24
+
"agent": "security-reviewer",
29
25
"prompt": "Review this code for security issues:\n\n{{steps.read_file.result}}",
30
-
"model": "anthropic:claude-sonnet-4-20250514",
31
-
"maxTokens": 1000,
32
26
"after": ["read_file"]
33
27
},
34
28
{
35
29
"id": "perf_review",
36
30
"type": "agent",
37
31
"description": "Performance analysis",
38
-
"system": "You are a performance engineer. Identify bottlenecks, memory leaks, N+1 queries, and optimization opportunities. Be concise and specific.",
32
+
"agent": "performance-reviewer",
39
33
"prompt": "Review this code for performance issues:\n\n{{steps.read_file.result}}",
40
-
"model": "anthropic:claude-sonnet-4-20250514",
41
-
"maxTokens": 1000,
42
34
"after": ["read_file"]
43
35
},
44
36
{
45
37
"id": "quality_review",
46
38
"type": "agent",
47
39
"description": "Code quality analysis",
48
-
"system": "You are a senior developer. Review for readability, maintainability, error handling, and best practices. Be concise and specific.",
40
+
"agent": "quality-reviewer",
49
41
"prompt": "Review this code for quality issues:\n\n{{steps.read_file.result}}",
50
-
"model": "anthropic:claude-sonnet-4-20250514",
51
-
"maxTokens": 1000,
52
42
"after": ["read_file"]
53
43
},
54
44
{
55
45
"id": "synthesize",
56
46
"type": "agent",
57
47
"description": "Synthesize reviews into prioritized action items",
58
-
"system": "You are a techlead. Synthesize multiple code reviews into a single prioritized action list. Group issues by severity: critical, high, medium, low. Be actionable.",
48
+
"agent": "tech-lead",
59
49
"prompt": "Combine these code reviews into a prioritized report:\n\n## Security Review\n{{steps.security_review.response}}\n\n## Performance Review\n{{steps.perf_review.response}}\n\n## Quality Review\n{{steps.quality_review.response}}",
"system": "You are a codefixer. Apply the requested fixes to the code. Output ONLY the complete corrected code with no explanations or markdown.",
63
+
"agent": "code-fixer",
76
64
"prompt": "Fix the critical and high severity issues in this code:\n\nOriginal code:\n{{steps.read_file.result}}\n\nIssues to fix:\n{{steps.synthesize.response}}",
0 commit comments