claude_swarm 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{CHANGELOG.md → CHANGELOG.claude-swarm.md} +3 -0
- data/CLAUDE.md +0 -1
- data/decisions/2025-11-22-001-global-agent-registry.md +172 -0
- data/docs/v2/CHANGELOG.swarm_cli.md +12 -0
- data/docs/v2/CHANGELOG.swarm_memory.md +139 -0
- data/docs/v2/CHANGELOG.swarm_sdk.md +249 -1
- data/docs/v2/README.md +15 -5
- data/docs/v2/guides/complete-tutorial.md +93 -7
- data/docs/v2/guides/getting-started.md +3 -1
- data/docs/v2/guides/memory-adapters.md +41 -0
- data/docs/v2/guides/{migrating-to-2.3.md → migrating-to-2.x.md} +213 -8
- data/docs/v2/guides/plugins.md +52 -5
- data/docs/v2/guides/rails-integration.md +6 -0
- data/docs/v2/guides/swarm-memory.md +2 -13
- data/docs/v2/reference/cli.md +0 -1
- data/docs/v2/reference/configuration_reference.md +300 -0
- data/docs/v2/reference/event_payload_structures.md +26 -4
- data/docs/v2/reference/ruby-dsl.md +457 -4
- data/docs/v2/reference/swarm_memory_technical_details.md +7 -29
- data/docs/v2/reference/yaml.md +2 -2
- data/lib/claude_swarm/mcp_generator.rb +1 -1
- data/lib/claude_swarm/orchestrator.rb +8 -1
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_memory/core/semantic_index.rb +10 -2
- data/lib/swarm_memory/core/storage.rb +7 -2
- data/lib/swarm_memory/dsl/memory_config.rb +37 -0
- data/lib/swarm_memory/integration/sdk_plugin.rb +120 -27
- data/lib/swarm_memory/optimization/defragmenter.rb +1 -1
- data/lib/swarm_memory/prompts/memory_researcher.md.erb +0 -1
- data/lib/swarm_memory/tools/load_skill.rb +0 -1
- data/lib/swarm_memory/tools/memory_edit.rb +2 -1
- data/lib/swarm_memory/tools/memory_read.rb +1 -1
- data/lib/swarm_memory/version.rb +1 -1
- data/lib/swarm_memory.rb +7 -5
- data/lib/swarm_sdk/agent/chat.rb +1 -1
- data/lib/swarm_sdk/agent/chat_helpers/context_tracker.rb +4 -0
- data/lib/swarm_sdk/agent/chat_helpers/hook_integration.rb +1 -1
- data/lib/swarm_sdk/agent/chat_helpers/llm_configuration.rb +38 -4
- data/lib/swarm_sdk/agent/chat_helpers/logging_helpers.rb +2 -2
- data/lib/swarm_sdk/agent/chat_helpers/system_reminder_injector.rb +3 -5
- data/lib/swarm_sdk/agent/chat_helpers/token_tracking.rb +48 -0
- data/lib/swarm_sdk/agent/context.rb +1 -2
- data/lib/swarm_sdk/agent/definition.rb +3 -3
- data/lib/swarm_sdk/agent/system_prompt_builder.rb +1 -1
- data/lib/swarm_sdk/agent_registry.rb +146 -0
- data/lib/swarm_sdk/builders/base_builder.rb +91 -12
- data/lib/swarm_sdk/config.rb +302 -0
- data/lib/swarm_sdk/configuration/parser.rb +22 -2
- data/lib/swarm_sdk/configuration.rb +13 -4
- data/lib/swarm_sdk/context_compactor/token_counter.rb +2 -6
- data/lib/swarm_sdk/custom_tool_registry.rb +226 -0
- data/lib/swarm_sdk/hooks/adapter.rb +3 -3
- data/lib/swarm_sdk/hooks/shell_executor.rb +4 -3
- data/lib/swarm_sdk/models.json +4333 -1
- data/lib/swarm_sdk/models.rb +43 -2
- data/lib/swarm_sdk/plugin.rb +2 -2
- data/lib/swarm_sdk/result.rb +52 -0
- data/lib/swarm_sdk/swarm/agent_initializer.rb +1 -1
- data/lib/swarm_sdk/swarm/hook_triggers.rb +1 -0
- data/lib/swarm_sdk/swarm/logging_callbacks.rb +1 -0
- data/lib/swarm_sdk/swarm/tool_configurator.rb +18 -4
- data/lib/swarm_sdk/swarm.rb +76 -13
- data/lib/swarm_sdk/tools/bash.rb +7 -9
- data/lib/swarm_sdk/tools/glob.rb +5 -5
- data/lib/swarm_sdk/tools/read.rb +8 -8
- data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +4 -3
- data/lib/swarm_sdk/tools/web_fetch.rb +20 -18
- data/lib/swarm_sdk/version.rb +1 -1
- data/lib/swarm_sdk/workflow/builder.rb +49 -0
- data/lib/swarm_sdk/workflow/node_builder.rb +4 -2
- data/lib/swarm_sdk/workflow/transformer_executor.rb +4 -3
- data/lib/swarm_sdk.rb +261 -105
- data/swarm_cli.gemspec +1 -1
- data/swarm_memory.gemspec +8 -3
- data/swarm_sdk.gemspec +4 -4
- data/team_full.yml +104 -300
- metadata +9 -5
- data/lib/swarm_memory/tools/memory_multi_edit.rb +0 -281
- /data/lib/swarm_memory/{errors.rb → error.rb} +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Configuration Reference
|
|
2
|
+
|
|
3
|
+
This document provides a comprehensive reference for all SwarmSDK configuration options. Configuration can be set via environment variables or programmatically through `SwarmSDK.configure`.
|
|
4
|
+
|
|
5
|
+
## Configuration Priority
|
|
6
|
+
|
|
7
|
+
Values are resolved in this order:
|
|
8
|
+
1. **Explicit value** (set via `SwarmSDK.configure`)
|
|
9
|
+
2. **Environment variable**
|
|
10
|
+
3. **Default value**
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
SwarmSDK.configure do |config|
|
|
16
|
+
# API Keys
|
|
17
|
+
config.openai_api_key = "sk-..."
|
|
18
|
+
|
|
19
|
+
# Defaults
|
|
20
|
+
config.default_model = "claude-sonnet-4"
|
|
21
|
+
config.agent_request_timeout = 600
|
|
22
|
+
|
|
23
|
+
# WebFetch
|
|
24
|
+
config.webfetch_provider = "anthropic"
|
|
25
|
+
config.webfetch_model = "claude-3-5-haiku-20241022"
|
|
26
|
+
end
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## API Keys
|
|
32
|
+
|
|
33
|
+
API keys are automatically proxied to `RubyLLM.config` when set.
|
|
34
|
+
|
|
35
|
+
| Environment Variable | Config Key | Description | Default |
|
|
36
|
+
|---------------------|------------|-------------|---------|
|
|
37
|
+
| `OPENAI_API_KEY` | `openai_api_key` | OpenAI API authentication key | `nil` |
|
|
38
|
+
| `OPENAI_API_BASE` | `openai_api_base` | Custom OpenAI-compatible API endpoint URL | `nil` |
|
|
39
|
+
| `OPENAI_ORG_ID` | `openai_organization_id` | OpenAI organization identifier | `nil` |
|
|
40
|
+
| `OPENAI_PROJECT_ID` | `openai_project_id` | OpenAI project identifier | `nil` |
|
|
41
|
+
| `ANTHROPIC_API_KEY` | `anthropic_api_key` | Anthropic (Claude) API authentication key | `nil` |
|
|
42
|
+
| `GEMINI_API_KEY` | `gemini_api_key` | Google Gemini API authentication key | `nil` |
|
|
43
|
+
| `GEMINI_API_BASE` | `gemini_api_base` | Custom Gemini API endpoint URL | `nil` |
|
|
44
|
+
| `GOOGLE_CLOUD_PROJECT` | `vertexai_project_id` | Google Cloud project ID for Vertex AI | `nil` |
|
|
45
|
+
| `GOOGLE_CLOUD_LOCATION` | `vertexai_location` | Google Cloud region for Vertex AI | `nil` |
|
|
46
|
+
| `DEEPSEEK_API_KEY` | `deepseek_api_key` | DeepSeek API authentication key | `nil` |
|
|
47
|
+
| `MISTRAL_API_KEY` | `mistral_api_key` | Mistral AI API authentication key | `nil` |
|
|
48
|
+
| `PERPLEXITY_API_KEY` | `perplexity_api_key` | Perplexity API authentication key | `nil` |
|
|
49
|
+
| `OPENROUTER_API_KEY` | `openrouter_api_key` | OpenRouter API authentication key | `nil` |
|
|
50
|
+
| `AWS_ACCESS_KEY_ID` | `bedrock_api_key` | AWS access key for Bedrock | `nil` |
|
|
51
|
+
| `AWS_SECRET_ACCESS_KEY` | `bedrock_secret_key` | AWS secret key for Bedrock | `nil` |
|
|
52
|
+
| `AWS_REGION` | `bedrock_region` | AWS region for Bedrock | `nil` |
|
|
53
|
+
| `AWS_SESSION_TOKEN` | `bedrock_session_token` | AWS session token for temporary credentials | `nil` |
|
|
54
|
+
| `OLLAMA_API_BASE` | `ollama_api_base` | Local Ollama server URL | `nil` |
|
|
55
|
+
| `GPUSTACK_API_BASE` | `gpustack_api_base` | GPUStack server URL | `nil` |
|
|
56
|
+
| `GPUSTACK_API_KEY` | `gpustack_api_key` | GPUStack API authentication key | `nil` |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Agent & Swarm Defaults
|
|
61
|
+
|
|
62
|
+
Default values for agent and swarm configuration.
|
|
63
|
+
|
|
64
|
+
| Environment Variable | Config Key | Description | Default |
|
|
65
|
+
|---------------------|------------|-------------|---------|
|
|
66
|
+
| `SWARM_SDK_DEFAULT_MODEL` | `default_model` | Default LLM model when not specified per-agent | `"gpt-5"` |
|
|
67
|
+
| `SWARM_SDK_DEFAULT_PROVIDER` | `default_provider` | Default LLM provider when not specified per-agent | `"openai"` |
|
|
68
|
+
| `SWARM_SDK_GLOBAL_CONCURRENCY_LIMIT` | `global_concurrency_limit` | Maximum concurrent API calls across entire swarm | `50` |
|
|
69
|
+
| `SWARM_SDK_LOCAL_CONCURRENCY_LIMIT` | `local_concurrency_limit` | Maximum parallel tool executions per agent | `10` |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Timeouts
|
|
74
|
+
|
|
75
|
+
Timeout values for various operations.
|
|
76
|
+
|
|
77
|
+
| Environment Variable | Config Key | Description | Default |
|
|
78
|
+
|---------------------|------------|-------------|---------|
|
|
79
|
+
| `SWARM_SDK_AGENT_REQUEST_TIMEOUT` | `agent_request_timeout` | LLM API request timeout in seconds | `300` (5 min) |
|
|
80
|
+
| `SWARM_SDK_BASH_COMMAND_TIMEOUT` | `bash_command_timeout` | Bash command execution timeout in milliseconds | `120000` (2 min) |
|
|
81
|
+
| `SWARM_SDK_BASH_COMMAND_MAX_TIMEOUT` | `bash_command_max_timeout` | Maximum allowed bash command timeout in milliseconds | `600000` (10 min) |
|
|
82
|
+
| `SWARM_SDK_WEB_FETCH_TIMEOUT` | `web_fetch_timeout` | HTTP request timeout for WebFetch tool in seconds | `30` |
|
|
83
|
+
| `SWARM_SDK_HOOK_SHELL_TIMEOUT` | `hook_shell_timeout` | Shell hook executor timeout in seconds | `60` |
|
|
84
|
+
| `SWARM_SDK_TRANSFORMER_COMMAND_TIMEOUT` | `transformer_command_timeout` | Workflow transformer command timeout in seconds | `60` |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Output & Content Limits
|
|
89
|
+
|
|
90
|
+
Limits for output sizes and content lengths.
|
|
91
|
+
|
|
92
|
+
| Environment Variable | Config Key | Description | Default |
|
|
93
|
+
|---------------------|------------|-------------|---------|
|
|
94
|
+
| `SWARM_SDK_OUTPUT_CHARACTER_LIMIT` | `output_character_limit` | Maximum characters in Bash command output | `30000` |
|
|
95
|
+
| `SWARM_SDK_READ_LINE_LIMIT` | `read_line_limit` | Default number of lines to read from files | `2000` |
|
|
96
|
+
| `SWARM_SDK_LINE_CHARACTER_LIMIT` | `line_character_limit` | Maximum characters per line in Read output | `2000` |
|
|
97
|
+
| `SWARM_SDK_WEB_FETCH_CHARACTER_LIMIT` | `web_fetch_character_limit` | Maximum characters from web page content | `100000` |
|
|
98
|
+
| `SWARM_SDK_GLOB_RESULT_LIMIT` | `glob_result_limit` | Maximum file paths returned by Glob tool | `1000` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Storage Limits
|
|
103
|
+
|
|
104
|
+
Limits for persistent storage.
|
|
105
|
+
|
|
106
|
+
| Environment Variable | Config Key | Description | Default |
|
|
107
|
+
|---------------------|------------|-------------|---------|
|
|
108
|
+
| `SWARM_SDK_SCRATCHPAD_ENTRY_SIZE_LIMIT` | `scratchpad_entry_size_limit` | Maximum size for single scratchpad entry in bytes | `3000000` (3 MB) |
|
|
109
|
+
| `SWARM_SDK_SCRATCHPAD_TOTAL_SIZE_LIMIT` | `scratchpad_total_size_limit` | Maximum total scratchpad storage in bytes | `100000000000` (100 GB) |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Context Management
|
|
114
|
+
|
|
115
|
+
Settings for context management and optimization.
|
|
116
|
+
|
|
117
|
+
| Environment Variable | Config Key | Description | Default |
|
|
118
|
+
|---------------------|------------|-------------|---------|
|
|
119
|
+
| `SWARM_SDK_CONTEXT_COMPRESSION_THRESHOLD` | `context_compression_threshold` | Context usage percentage triggering compression warning | `60` |
|
|
120
|
+
| `SWARM_SDK_TODOWRITE_REMINDER_INTERVAL` | `todowrite_reminder_interval` | Message count between TodoWrite reminders | `8` |
|
|
121
|
+
| `SWARM_SDK_CHARS_PER_TOKEN_PROSE` | `chars_per_token_prose` | Characters per token for prose text estimation | `4.0` |
|
|
122
|
+
| `SWARM_SDK_CHARS_PER_TOKEN_CODE` | `chars_per_token_code` | Characters per token for code estimation | `3.5` |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Logging
|
|
127
|
+
|
|
128
|
+
Logging configuration settings.
|
|
129
|
+
|
|
130
|
+
| Environment Variable | Config Key | Description | Default |
|
|
131
|
+
|---------------------|------------|-------------|---------|
|
|
132
|
+
| `SWARM_SDK_MCP_LOG_LEVEL` | `mcp_log_level` | Log level for MCP client (0=DEBUG, 1=INFO, 2=WARN, 3=ERROR) | `2` (WARN) |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## WebFetch LLM Processing
|
|
137
|
+
|
|
138
|
+
Settings for WebFetch tool's optional LLM content processing.
|
|
139
|
+
|
|
140
|
+
| Environment Variable | Config Key | Description | Default |
|
|
141
|
+
|---------------------|------------|-------------|---------|
|
|
142
|
+
| `SWARM_SDK_WEBFETCH_PROVIDER` | `webfetch_provider` | LLM provider for WebFetch content processing | `nil` |
|
|
143
|
+
| `SWARM_SDK_WEBFETCH_MODEL` | `webfetch_model` | LLM model for WebFetch content processing | `nil` |
|
|
144
|
+
| `SWARM_SDK_WEBFETCH_BASE_URL` | `webfetch_base_url` | Custom API endpoint for WebFetch LLM | `nil` |
|
|
145
|
+
| `SWARM_SDK_WEBFETCH_MAX_TOKENS` | `webfetch_max_tokens` | Maximum tokens for WebFetch LLM responses | `4096` |
|
|
146
|
+
|
|
147
|
+
**Note:** WebFetch LLM processing is enabled when both `webfetch_provider` and `webfetch_model` are configured. When enabled, the `prompt` parameter is required when calling WebFetch.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Security Settings
|
|
152
|
+
|
|
153
|
+
Security-related configuration options.
|
|
154
|
+
|
|
155
|
+
| Environment Variable | Config Key | Description | Default |
|
|
156
|
+
|---------------------|------------|-------------|---------|
|
|
157
|
+
| `SWARM_SDK_ALLOW_FILESYSTEM_TOOLS` | `allow_filesystem_tools` | Global toggle to enable/disable filesystem tools (Read, Write, Edit, Glob, Grep) | `true` |
|
|
158
|
+
| `SWARM_SDK_ENV_INTERPOLATION` | `env_interpolation` | Global toggle to enable/disable environment variable interpolation in YAML configs | `true` |
|
|
159
|
+
|
|
160
|
+
**Boolean Environment Variable Values:**
|
|
161
|
+
- True: `true`, `yes`, `1`, `on`, `enabled`
|
|
162
|
+
- False: `false`, `no`, `0`, `off`, `disabled`
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## YAML Environment Variable Interpolation
|
|
167
|
+
|
|
168
|
+
YAML configurations support environment variable interpolation using the `${VAR}` and `${VAR:=default}` syntax. This feature can be controlled globally or per-load.
|
|
169
|
+
|
|
170
|
+
### Interpolation Syntax
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# Required variable (raises error if not set)
|
|
174
|
+
model: ${OPENAI_MODEL}
|
|
175
|
+
|
|
176
|
+
# Variable with default value
|
|
177
|
+
model: ${OPENAI_MODEL:=gpt-4}
|
|
178
|
+
|
|
179
|
+
# Empty default
|
|
180
|
+
api_key: ${OPTIONAL_KEY:=}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Disabling Interpolation
|
|
184
|
+
|
|
185
|
+
**Per-load** (highest priority):
|
|
186
|
+
```ruby
|
|
187
|
+
# Disable for a specific load
|
|
188
|
+
swarm = SwarmSDK.load(yaml_content, env_interpolation: false)
|
|
189
|
+
swarm = SwarmSDK.load_file("config.yml", env_interpolation: false)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Globally** (via configuration):
|
|
193
|
+
```ruby
|
|
194
|
+
SwarmSDK.configure do |config|
|
|
195
|
+
config.env_interpolation = false
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Globally** (via environment variable):
|
|
200
|
+
```bash
|
|
201
|
+
export SWARM_SDK_ENV_INTERPOLATION=false
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Priority Order
|
|
205
|
+
|
|
206
|
+
1. Per-load parameter (`env_interpolation:`) - highest priority
|
|
207
|
+
2. Global config (`SwarmSDK.config.env_interpolation`)
|
|
208
|
+
3. Environment variable (`SWARM_SDK_ENV_INTERPOLATION`)
|
|
209
|
+
4. Default (`true`) - lowest priority
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Examples
|
|
214
|
+
|
|
215
|
+
### Minimal Configuration (ENV only)
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# .env
|
|
219
|
+
OPENAI_API_KEY=sk-...
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```ruby
|
|
223
|
+
require "swarm_sdk"
|
|
224
|
+
|
|
225
|
+
# No explicit configuration needed - lazy loads from ENV
|
|
226
|
+
swarm = SwarmSDK.build do
|
|
227
|
+
name "My Swarm"
|
|
228
|
+
lead :assistant
|
|
229
|
+
agent :assistant do
|
|
230
|
+
description "General assistant"
|
|
231
|
+
prompt "You are helpful"
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Full Configuration
|
|
237
|
+
|
|
238
|
+
```ruby
|
|
239
|
+
SwarmSDK.configure do |config|
|
|
240
|
+
# API Keys
|
|
241
|
+
config.openai_api_key = ENV["OPENAI_API_KEY"]
|
|
242
|
+
config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
|
|
243
|
+
|
|
244
|
+
# Agent Defaults
|
|
245
|
+
config.default_model = "claude-sonnet-4"
|
|
246
|
+
config.default_provider = "anthropic"
|
|
247
|
+
config.agent_request_timeout = 600
|
|
248
|
+
|
|
249
|
+
# Concurrency
|
|
250
|
+
config.global_concurrency_limit = 100
|
|
251
|
+
config.local_concurrency_limit = 20
|
|
252
|
+
|
|
253
|
+
# Timeouts
|
|
254
|
+
config.bash_command_timeout = 180_000
|
|
255
|
+
config.web_fetch_timeout = 60
|
|
256
|
+
|
|
257
|
+
# Limits
|
|
258
|
+
config.output_character_limit = 50_000
|
|
259
|
+
config.read_line_limit = 5000
|
|
260
|
+
|
|
261
|
+
# WebFetch LLM
|
|
262
|
+
config.webfetch_provider = "openai"
|
|
263
|
+
config.webfetch_model = "gpt-4o-mini"
|
|
264
|
+
config.webfetch_max_tokens = 8192
|
|
265
|
+
|
|
266
|
+
# Security
|
|
267
|
+
config.allow_filesystem_tools = true
|
|
268
|
+
end
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Testing Configuration
|
|
272
|
+
|
|
273
|
+
```ruby
|
|
274
|
+
# test/test_helper.rb
|
|
275
|
+
def setup
|
|
276
|
+
SwarmSDK.reset_config!
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def teardown
|
|
280
|
+
SwarmSDK.reset_config!
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# test/my_test.rb
|
|
284
|
+
def test_with_custom_config
|
|
285
|
+
SwarmSDK.configure do |config|
|
|
286
|
+
config.openai_api_key = "test-key"
|
|
287
|
+
config.agent_request_timeout = 60
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Test code here
|
|
291
|
+
end
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## See Also
|
|
297
|
+
|
|
298
|
+
- [Ruby DSL Reference](ruby-dsl.md) - Programmatic swarm building
|
|
299
|
+
- [YAML Configuration](yaml-configuration.md) - YAML-based swarm definitions
|
|
300
|
+
- [Changelog](../CHANGELOG.swarm_sdk.md) - Version history and breaking changes
|
|
@@ -72,13 +72,35 @@ Emitted when swarm execution completes (success or error).
|
|
|
72
72
|
duration: 277.5, # Seconds (Float)
|
|
73
73
|
total_cost: 0.00234, # USD (Float)
|
|
74
74
|
total_tokens: 12450, # Integer
|
|
75
|
-
agents_involved: [:lead, :backend, :frontend] # Array of agent names
|
|
75
|
+
agents_involved: [:lead, :backend, :frontend], # Array of agent names
|
|
76
|
+
per_agent_usage: { # Per-agent usage breakdown (Hash)
|
|
77
|
+
lead: {
|
|
78
|
+
input_tokens: 5200,
|
|
79
|
+
output_tokens: 1800,
|
|
80
|
+
total_tokens: 7000,
|
|
81
|
+
input_cost: 0.00156,
|
|
82
|
+
output_cost: 0.00054,
|
|
83
|
+
total_cost: 0.0021,
|
|
84
|
+
context_limit: 200000,
|
|
85
|
+
context_usage_percentage: 3.5
|
|
86
|
+
},
|
|
87
|
+
backend: {
|
|
88
|
+
input_tokens: 3250,
|
|
89
|
+
output_tokens: 1200,
|
|
90
|
+
total_tokens: 4450,
|
|
91
|
+
input_cost: 0.00015,
|
|
92
|
+
output_cost: 0.00009,
|
|
93
|
+
total_cost: 0.00024,
|
|
94
|
+
context_limit: 128000,
|
|
95
|
+
context_usage_percentage: 3.48
|
|
96
|
+
}
|
|
97
|
+
}
|
|
76
98
|
}
|
|
77
99
|
```
|
|
78
100
|
|
|
79
101
|
**Field Locations**:
|
|
80
|
-
- Root level: All fields including `swarm_id` and `
|
|
81
|
-
-
|
|
102
|
+
- Root level: All fields including `swarm_id`, `parent_swarm_id`, and `per_agent_usage`
|
|
103
|
+
- Nested in `per_agent_usage`: Per-agent hash with token counts, costs, context metrics
|
|
82
104
|
|
|
83
105
|
---
|
|
84
106
|
|
|
@@ -677,7 +699,7 @@ Emitted after receiving HTTP response from LLM API provider (only when logging i
|
|
|
677
699
|
| Event | Root Fields | Nested Fields |
|
|
678
700
|
|-------|-------------|---------------|
|
|
679
701
|
| `swarm_start` | swarm_name, lead_agent, prompt | None |
|
|
680
|
-
| `swarm_stop` | swarm_name, lead_agent, last_agent, content, success, duration, total_cost, total_tokens, agents_involved |
|
|
702
|
+
| `swarm_stop` | swarm_name, lead_agent, last_agent, content, success, duration, total_cost, total_tokens, agents_involved, per_agent_usage | per_agent_usage.{agent}.* |
|
|
681
703
|
| `agent_start` | swarm_name, model, provider, directory, system_prompt, tools, delegates_to | plugin_storages.* |
|
|
682
704
|
| `agent_stop` | model, content, tool_calls, finish_reason, tool_executions | usage.*, metadata.* |
|
|
683
705
|
| `agent_step` | model, content, tool_calls, finish_reason, tool_executions | usage.*, tool_calls[].*, metadata.* |
|