Agent Workflow Patterns
Common patterns for building agent workflows in CCOS
Best use case
Agent Workflow Patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Common patterns for building agent workflows in CCOS
Teams using Agent Workflow Patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/agent-workflows/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Agent Workflow Patterns Compares
| Feature / Agent | Agent Workflow Patterns | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Common patterns for building agent workflows in CCOS
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Agent Workflow Patterns
Common patterns for building effective agent workflows in CCOS.
## Discovery → Execution Flow
The standard pattern for accomplishing goals:
```
┌─────────────────┐
│ 1. Search │ ccos_search or ccos_plan
└────────┬────────┘
▼
┌─────────────────┐
│ 2. Inspect │ ccos_inspect_capability
└────────┬────────┘
▼
┌─────────────────┐
│ 3. Execute │ ccos_execute_capability
└────────┬────────┘
▼
┌─────────────────┐
│ 4. Learn │ ccos_log_thought (if needed)
└─────────────────┘
```
### Example: Weather Query
```
1. ccos_search { query: "weather current city" }
→ Returns: weather.get_current (score: 0.85)
2. ccos_inspect_capability { capability_id: "weather.get_current" }
→ Returns: input_schema with { city: string, units: string? }
3. ccos_execute_capability {
capability_id: "weather.get_current",
inputs: { city: "Paris", units: "metric" }
}
→ Returns: { temperature: 18, conditions: "cloudy" }
```
## Session-Based Multi-Step
For complex goals requiring multiple capabilities:
```
1. ccos_session_start { goal: "Generate daily report" }
→ Returns: session_id
2. ccos_execute_capability {
capability_id: "weather.get_current",
inputs: { city: "Paris" },
session_id: "session_xxx"
}
3. ccos_execute_capability {
capability_id: "crypto.get_price",
inputs: { symbol: "BTC" },
session_id: "session_xxx"
}
4. ccos_session_plan { session_id: "session_xxx" }
→ Returns: accumulated RTFS plan
5. ccos_session_end { session_id: "session_xxx" }
→ Saves plan to file
```
## Gap Resolution Pattern
When `ccos_plan` identifies missing capabilities:
```
1. ccos_plan { goal: "get flight prices to tokyo" }
→ Returns: { status: "gap", suggested_query: "flight booking API" }
2. ccos_suggest_apis { query: "flight booking API" }
→ Returns: [{ name: "Skyscanner", docs_url: "..." }]
3. ccos_introspect_remote_api { endpoint: "..." }
→ Creates approval request
4. [User approves at /approvals]
5. ccos_register_server { approval_id: "..." }
→ Capabilities now available
6. ccos_plan { goal: "get flight prices to tokyo" }
→ Now resolves successfully!
```
## Error Handling Pattern
Handle failures gracefully using logging:
```
1. ccos_execute_capability { ... }
→ Returns: { success: false, error: "API rate limited" }
2. ccos_log_thought {
thought: "API rate limited, will retry after delay",
is_failure: true
}
3. [Wait or try alternative]
4. ccos_execute_capability { ... } # Retry
```
## Learning from Failures
Record patterns to avoid repeating mistakes:
```clojure
;; When something goes wrong
ccos_log_thought {
thought: "Parameter 'symbol' requires uppercase (BTC not btc)",
plan_id: "crypto_fetch",
is_failure: true
}
;; Explicitly record the learning
ccos_record_learning {
pattern: "Always uppercase cryptocurrency symbols",
context: "crypto API calls",
outcome: "Prevents 400 errors",
confidence: 0.95
}
;; Later, recall before similar tasks
ccos_recall_memories { tags: ["crypto", "learning"] }
```
## Reusable Agent Creation
Convert successful sessions into permanent agents:
```
1. Complete a multi-step session successfully
2. ccos_consolidate_session {
session_id: "session_xxx",
agent_name: "daily_reporter",
description: "Generates weather + crypto reports"
}
→ Creates: capabilities/agents/daily_reporter.rtfs
3. Future use:
ccos_execute_capability {
capability_id: "agent.daily_reporter",
inputs: { city: "Paris" }
}
```
## Governance-First Pattern
Always check approvals for sensitive operations:
```
1. ccos_check_secrets { secret_names: ["GITHUB_TOKEN"] }
→ If missing: "CRITICAL: Ask user to approve at /approvals"
2. [Wait for user confirmation]
3. ccos_execute_capability { ... }
```
## Best Practices
### Do's ✅
- Use `ccos_execute_capability` for capability calls (not raw RTFS)
- Start sessions for multi-step workflows
- Log thoughts for debugging and learning
- Check secrets before API calls
- Wait for user approval when required
### Don'ts ❌
- Don't guess API keys or secrets
- Don't bypass the approval system
- Don't retry indefinitely on failures
- Don't ignore `agent_guidance` in responses
- Don't write raw RTFS unless specifically needed
## Quick Reference
| Goal | Primary Tool |
|------|-------------|
| Find capabilities | `ccos_search` |
| Decompose goal | `ccos_plan` |
| Execute capability | `ccos_execute_capability` |
| Track multi-step | `ccos_session_start/end` |
| Add external API | `ccos_introspect_remote_api` |
| Check available secrets | `ccos_check_secrets` |
| Learn from execution | `ccos_log_thought` |
| Create agent | `ccos_consolidate_session` |Related Skills
builder_agent
Builder agent that installs durable specialist workers from chat requests.
__AGENT_ID__
Memory-first quickstart agent for gateway terminal chat.
researcher.default
Research-focused autonomous agent for evidence collection.
evaluator.default
Validation and testing autonomous agent.
debugger.default
Debugging and root cause analysis agent.
architect.default
Design, structure, and task decomposition agent.
planner.default
Front-door lead agent for ambiguous goals.
specialized_builder.default
Installs new durable agents into the runtime.
agent-adapter.default
Generates wrapper agents for I/O gaps
RTFS Grammar
Learn RTFS (Reason about The Functional Spec) - the pure functional language for CCOS agents
CCOS MCP Tools
Reference for all MCP tools exposed by the CCOS server for agent interactions
Capability Development
Guide for creating, registering, and managing CCOS/RTFS capabilities