claude_swarm 1.0.8 → 1.0.10
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 +15 -0
- data/CLAUDE.md +347 -191
- data/docs/v1/README.md +10 -0
- data/docs/v2/CHANGELOG.swarm_cli.md +8 -0
- data/docs/v2/CHANGELOG.swarm_memory.md +7 -1
- data/docs/v2/CHANGELOG.swarm_sdk.md +184 -9
- data/docs/v2/README.md +6 -1
- data/docs/v2/guides/complete-tutorial.md +2 -2
- data/docs/v2/guides/getting-started.md +7 -7
- data/docs/v2/guides/migrating-to-2.3.md +541 -0
- data/docs/v2/guides/snapshots.md +14 -14
- data/docs/v2/reference/architecture-flow.md +3 -3
- data/docs/v2/reference/event_payload_structures.md +1 -1
- data/docs/v2/reference/ruby-dsl.md +157 -14
- data/docs/v2/reference/yaml.md +170 -52
- data/examples/snapshot_demo.rb +2 -2
- data/lib/claude_swarm/claude_mcp_server.rb +1 -0
- data/lib/claude_swarm/cli.rb +5 -0
- data/lib/claude_swarm/configuration.rb +2 -1
- data/lib/claude_swarm/mcp_generator.rb +8 -20
- data/lib/claude_swarm/openai/chat_completion.rb +2 -1
- data/lib/claude_swarm/openai/executor.rb +3 -1
- data/lib/claude_swarm/openai/responses.rb +11 -21
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/swarm_cli/commands/run.rb +2 -2
- data/lib/swarm_cli/config_loader.rb +11 -11
- data/lib/swarm_cli/formatters/human_formatter.rb +0 -33
- data/lib/swarm_cli/interactive_repl.rb +2 -2
- data/lib/swarm_cli/ui/icons.rb +0 -23
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_memory/adapters/filesystem_adapter.rb +11 -34
- data/lib/swarm_memory/integration/sdk_plugin.rb +87 -7
- data/lib/swarm_memory/version.rb +1 -1
- data/lib/swarm_memory.rb +1 -1
- data/lib/swarm_sdk/agent/builder.rb +58 -0
- data/lib/swarm_sdk/agent/chat.rb +527 -1061
- data/lib/swarm_sdk/agent/{chat → chat_helpers}/context_tracker.rb +9 -88
- data/lib/swarm_sdk/agent/chat_helpers/event_emitter.rb +204 -0
- data/lib/swarm_sdk/agent/{chat → chat_helpers}/hook_integration.rb +108 -46
- data/lib/swarm_sdk/agent/chat_helpers/instrumentation.rb +78 -0
- data/lib/swarm_sdk/agent/chat_helpers/llm_configuration.rb +233 -0
- data/lib/swarm_sdk/agent/{chat → chat_helpers}/logging_helpers.rb +1 -1
- data/lib/swarm_sdk/agent/chat_helpers/serialization.rb +83 -0
- data/lib/swarm_sdk/agent/{chat → chat_helpers}/system_reminder_injector.rb +12 -12
- data/lib/swarm_sdk/agent/chat_helpers/system_reminders.rb +79 -0
- data/lib/swarm_sdk/agent/chat_helpers/token_tracking.rb +98 -0
- data/lib/swarm_sdk/agent/context.rb +2 -2
- data/lib/swarm_sdk/agent/definition.rb +66 -154
- data/lib/swarm_sdk/agent/llm_instrumentation_middleware.rb +4 -2
- data/lib/swarm_sdk/agent/system_prompt_builder.rb +161 -0
- data/lib/swarm_sdk/builders/base_builder.rb +409 -0
- data/lib/swarm_sdk/concerns/cleanupable.rb +39 -0
- data/lib/swarm_sdk/concerns/snapshotable.rb +67 -0
- data/lib/swarm_sdk/concerns/validatable.rb +55 -0
- data/lib/swarm_sdk/configuration/parser.rb +353 -0
- data/lib/swarm_sdk/configuration/translator.rb +255 -0
- data/lib/swarm_sdk/configuration.rb +65 -543
- data/lib/swarm_sdk/context_compactor/token_counter.rb +3 -3
- data/lib/swarm_sdk/context_compactor.rb +6 -11
- data/lib/swarm_sdk/context_management/builder.rb +128 -0
- data/lib/swarm_sdk/context_management/context.rb +328 -0
- data/lib/swarm_sdk/defaults.rb +196 -0
- data/lib/swarm_sdk/events_to_messages.rb +18 -0
- data/lib/swarm_sdk/hooks/shell_executor.rb +2 -1
- data/lib/swarm_sdk/log_collector.rb +179 -29
- data/lib/swarm_sdk/log_stream.rb +29 -0
- data/lib/swarm_sdk/node_context.rb +1 -1
- data/lib/swarm_sdk/observer/builder.rb +81 -0
- data/lib/swarm_sdk/observer/config.rb +45 -0
- data/lib/swarm_sdk/observer/manager.rb +236 -0
- data/lib/swarm_sdk/patterns/agent_observer.rb +160 -0
- data/lib/swarm_sdk/plugin.rb +93 -3
- data/lib/swarm_sdk/snapshot.rb +6 -6
- data/lib/swarm_sdk/snapshot_from_events.rb +13 -2
- data/lib/swarm_sdk/state_restorer.rb +136 -151
- data/lib/swarm_sdk/state_snapshot.rb +65 -100
- data/lib/swarm_sdk/swarm/agent_initializer.rb +180 -136
- data/lib/swarm_sdk/swarm/builder.rb +44 -578
- data/lib/swarm_sdk/swarm/executor.rb +213 -0
- data/lib/swarm_sdk/swarm/hook_triggers.rb +150 -0
- data/lib/swarm_sdk/swarm/logging_callbacks.rb +340 -0
- data/lib/swarm_sdk/swarm/mcp_configurator.rb +7 -4
- data/lib/swarm_sdk/swarm/tool_configurator.rb +42 -138
- data/lib/swarm_sdk/swarm.rb +137 -680
- data/lib/swarm_sdk/tools/bash.rb +11 -3
- data/lib/swarm_sdk/tools/delegate.rb +61 -43
- data/lib/swarm_sdk/tools/edit.rb +8 -13
- data/lib/swarm_sdk/tools/glob.rb +9 -1
- data/lib/swarm_sdk/tools/grep.rb +7 -0
- data/lib/swarm_sdk/tools/multi_edit.rb +15 -11
- data/lib/swarm_sdk/tools/path_resolver.rb +51 -2
- data/lib/swarm_sdk/tools/read.rb +11 -13
- data/lib/swarm_sdk/tools/registry.rb +122 -10
- data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +8 -5
- data/lib/swarm_sdk/tools/stores/storage.rb +0 -6
- data/lib/swarm_sdk/tools/todo_write.rb +7 -0
- data/lib/swarm_sdk/tools/web_fetch.rb +3 -2
- data/lib/swarm_sdk/tools/write.rb +8 -13
- data/lib/swarm_sdk/version.rb +1 -1
- data/lib/swarm_sdk/{node → workflow}/agent_config.rb +1 -1
- data/lib/swarm_sdk/workflow/builder.rb +143 -0
- data/lib/swarm_sdk/workflow/executor.rb +497 -0
- data/lib/swarm_sdk/{node/builder.rb → workflow/node_builder.rb} +3 -3
- data/lib/swarm_sdk/{node → workflow}/transformer_executor.rb +3 -2
- data/lib/swarm_sdk/{node_orchestrator.rb → workflow.rb} +152 -456
- data/lib/swarm_sdk.rb +33 -3
- data/rubocop/cop/security/no_reflection_methods.rb +1 -1
- data/swarm_memory.gemspec +1 -1
- data/swarm_sdk.gemspec +4 -2
- data/team_full.yml +24 -24
- metadata +35 -11
- data/lib/swarm_memory/chat_extension.rb +0 -34
- data/lib/swarm_sdk/providers/openai_with_responses.rb +0 -589
|
@@ -5,7 +5,13 @@ All notable changes to SwarmMemory will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [2.1.4]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Updated documentation to reference `Workflow` instead of `NodeOrchestrator`
|
|
13
|
+
- Memory configuration preserved when agents are cloned in `Workflow` (formerly `NodeOrchestrator`)
|
|
14
|
+
- No functional changes - fully compatible with SwarmSDK refactoring
|
|
9
15
|
|
|
10
16
|
## [2.1.3] - 2025-11-06
|
|
11
17
|
|
|
@@ -5,10 +5,163 @@ All notable changes to SwarmSDK will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [2.3.0]
|
|
9
|
+
|
|
10
|
+
### Breaking Changes
|
|
11
|
+
|
|
12
|
+
- **Agent::Chat Abstraction Layer**: Refactored Agent::Chat from inheritance to composition with RubyLLM::Chat
|
|
13
|
+
- **Removed direct access**: SDK consumers can no longer access `.tools`, `.messages`, or `.model` directly
|
|
14
|
+
- **New abstraction methods**: SwarmSDK-specific API that hides RubyLLM internals
|
|
15
|
+
- `has_tool?(name)` - Check if tool exists by name (symbol or string)
|
|
16
|
+
- `tool_names` - Get array of tool names (symbols)
|
|
17
|
+
- `model_id` - Get model identifier string
|
|
18
|
+
- `model_provider` - Get model provider string
|
|
19
|
+
- `message_count` - Get number of messages in conversation
|
|
20
|
+
- `has_user_message?` - Check if conversation has any user messages
|
|
21
|
+
- `last_assistant_message` - Get most recent assistant message
|
|
22
|
+
- `take_snapshot` - Serialize conversation for persistence
|
|
23
|
+
- `restore_snapshot(data)` - Restore conversation from serialized data
|
|
24
|
+
- **Internal access methods**: For helper modules that need direct access
|
|
25
|
+
- `internal_messages` - Direct array of RubyLLM messages (for internal use only)
|
|
26
|
+
- `internal_tools` - Direct hash of tool instances (for internal use only)
|
|
27
|
+
- `internal_model` - Direct RubyLLM model object (for internal use only)
|
|
28
|
+
- **Migration**:
|
|
29
|
+
- `chat.tools.key?(:Read)` → `chat.has_tool?(:Read)`
|
|
30
|
+
- `chat.tools.keys` → `chat.tool_names`
|
|
31
|
+
- `chat.model.id` → `chat.model_id`
|
|
32
|
+
- `chat.model.provider` → `chat.model_provider`
|
|
33
|
+
- `chat.messages.count` → `chat.message_count`
|
|
34
|
+
- `chat.messages` (for internal modules) → `chat.internal_messages`
|
|
35
|
+
- **Improved encapsulation**: Prevents tight coupling to RubyLLM internals, making future LLM library changes easier
|
|
36
|
+
- **Files affected**:
|
|
37
|
+
- `lib/swarm_sdk/agent/chat.rb` - Core abstraction implementation
|
|
38
|
+
- `lib/swarm_sdk/swarm.rb` - Uses `tool_names` instead of `tools.keys`
|
|
39
|
+
- `lib/swarm_sdk/state_snapshot.rb` - Uses `internal_messages`
|
|
40
|
+
- `lib/swarm_sdk/state_restorer.rb` - Uses `internal_messages`
|
|
41
|
+
- `lib/swarm_sdk/context_compactor.rb` - Uses `internal_messages`
|
|
42
|
+
- `lib/swarm_sdk/agent/chat/hook_integration.rb` - Uses abstraction methods
|
|
43
|
+
- `lib/swarm_sdk/agent/chat/system_reminder_injector.rb` - Uses abstraction methods
|
|
44
|
+
- `lib/swarm_sdk/agent/chat/context_tracker.rb` - Uses `model_id`
|
|
45
|
+
|
|
46
|
+
- **MAJOR REFACTORING**: Separated Swarm and Workflow into distinct, clear APIs
|
|
47
|
+
- `SwarmSDK.build` now ONLY returns `Swarm` (simple multi-agent collaboration)
|
|
48
|
+
- New `SwarmSDK.workflow` API for multi-stage workflows (returns `Workflow`)
|
|
49
|
+
- `NodeOrchestrator` class renamed to `Workflow` (clearer naming)
|
|
50
|
+
- Attempting to use nodes in `SwarmSDK.build` now raises `ConfigurationError`
|
|
51
|
+
- Snapshot version bumped to 2.0.0 (old snapshots incompatible)
|
|
52
|
+
- Snapshot structure changed: `swarm:` key renamed to `metadata:`
|
|
53
|
+
|
|
54
|
+
- **YAML Configuration**: Explicit type keys for Swarm vs Workflow
|
|
55
|
+
- `swarm:` key now ONLY for Swarm configurations (requires `lead:`, cannot have `nodes:`)
|
|
56
|
+
- New `workflow:` key for Workflow configurations (requires `start_node:` and `nodes:`)
|
|
57
|
+
- Cannot have both `swarm:` and `workflow:` keys in same file
|
|
58
|
+
- Same `SwarmSDK.load_file` API works for both types (auto-detects from root key)
|
|
9
59
|
|
|
10
60
|
### Added
|
|
11
61
|
|
|
62
|
+
- New `SwarmSDK.workflow` DSL for building multi-stage workflows
|
|
63
|
+
- **YAML `workflow:` key support**: Explicit root key for workflow configurations
|
|
64
|
+
- Clearer separation between Swarm and Workflow in YAML files
|
|
65
|
+
- Configuration class with proper separation of concerns (type detection, validation, loading)
|
|
66
|
+
- Validates type-specific requirements (e.g., `swarm:` cannot have `nodes:`)
|
|
67
|
+
- Three new concern modules for shared functionality:
|
|
68
|
+
- `Concerns::Snapshotable` - Common snapshot/restore interface
|
|
69
|
+
- `Concerns::Validatable` - Common validation interface
|
|
70
|
+
- `Concerns::Cleanupable` - Common cleanup interface
|
|
71
|
+
- `Builders::BaseBuilder` - Shared DSL logic for both Swarm and Workflow builders
|
|
72
|
+
- Both `Swarm` and `Workflow` now implement common interface methods:
|
|
73
|
+
- `primary_agents` - Access to primary agent instances
|
|
74
|
+
- `delegation_instances_hash` - Access to delegation instances
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- `Workflow` (formerly `NodeOrchestrator`) internal structure simplified to match `Swarm`:
|
|
79
|
+
- Replaced `@agent_instance_cache = { primary: {}, delegations: {} }`
|
|
80
|
+
- With `@agents = {}` and `@delegation_instances = {}`
|
|
81
|
+
- `Swarm::Builder` dramatically simplified: 784 lines → 208 lines (73% reduction)
|
|
82
|
+
- `StateSnapshot` and `StateRestorer` no longer use type checking - rely on interface methods
|
|
83
|
+
- `SnapshotFromEvents` updated to generate v2.0.0 snapshots with new structure
|
|
84
|
+
- Module namespace: `Node::` renamed to `Workflow::`
|
|
85
|
+
- `Node::Builder` → `Workflow::NodeBuilder`
|
|
86
|
+
- `Node::AgentConfig` → `Workflow::AgentConfig`
|
|
87
|
+
- `Node::TransformerExecutor` → `Workflow::TransformerExecutor`
|
|
88
|
+
|
|
89
|
+
### Removed
|
|
90
|
+
|
|
91
|
+
- Dual-return-type pattern from `SwarmSDK.build` (no longer returns `NodeOrchestrator`)
|
|
92
|
+
- ~600 lines of duplicated code across Swarm and NodeOrchestrator
|
|
93
|
+
- Complex type-checking logic in StateSnapshot and StateRestorer
|
|
94
|
+
|
|
95
|
+
### Migration Guide
|
|
96
|
+
|
|
97
|
+
**For vanilla swarm users (no nodes):** No changes needed! Your code works as-is.
|
|
98
|
+
|
|
99
|
+
**For workflow users (using Ruby DSL):** Change `SwarmSDK.build` to `SwarmSDK.workflow`:
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
# Before
|
|
103
|
+
SwarmSDK.build do
|
|
104
|
+
node :planning { ... }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# After
|
|
108
|
+
SwarmSDK.workflow do
|
|
109
|
+
node :planning { ... }
|
|
110
|
+
end
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**For YAML workflow users:** Change `swarm:` key to `workflow:`:
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
# Before
|
|
117
|
+
version: 2
|
|
118
|
+
swarm:
|
|
119
|
+
name: "Pipeline"
|
|
120
|
+
start_node: planning
|
|
121
|
+
agents: { ... }
|
|
122
|
+
nodes: { ... }
|
|
123
|
+
|
|
124
|
+
# After
|
|
125
|
+
version: 2
|
|
126
|
+
workflow:
|
|
127
|
+
name: "Pipeline"
|
|
128
|
+
start_node: planning
|
|
129
|
+
agents: { ... }
|
|
130
|
+
nodes: { ... }
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**For event-sourcing users:** No changes needed! `SnapshotFromEvents.reconstruct(events)` automatically generates v2.0.0 snapshots.
|
|
134
|
+
|
|
135
|
+
**For snapshot storage users:** Old snapshots (v1.0.0) won't restore. Create new snapshots or convert:
|
|
136
|
+
```ruby
|
|
137
|
+
old[:version] = "2.0.0"
|
|
138
|
+
old[:metadata] = old.delete(:swarm)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Added
|
|
142
|
+
|
|
143
|
+
- **Non-Blocking Execution with Cancellation Support**: Optional `wait` parameter enables task cancellation
|
|
144
|
+
- **`wait: true` (default)**: Maintains backward-compatible blocking behavior, returns `Result`
|
|
145
|
+
- **`wait: false`**: Returns `Async::Task` immediately for non-blocking execution
|
|
146
|
+
- **`task.stop`**: Cancels execution at next fiber yield point (HTTP I/O, tool boundaries)
|
|
147
|
+
- **Cooperative cancellation**: Stops when fiber yields, not immediate for synchronous operations
|
|
148
|
+
- **Proper cleanup**: MCP clients, fiber storage, and logging cleaned in task's ensure block
|
|
149
|
+
- **Cleanup on cancellation**: Ensure blocks execute when task stopped via `Async::Stop` exception
|
|
150
|
+
- **`task.wait` returns nil**: Cancelled tasks return `nil` from `wait` method
|
|
151
|
+
- **Execution flow**: Reprompting loop and all cleanup moved inside Async block
|
|
152
|
+
- **Parent cleanup**: Fiber storage cleaned after `task.wait` when `wait: true`
|
|
153
|
+
- **Examples**:
|
|
154
|
+
- Blocking: `result = swarm.execute("Build auth")` (current behavior)
|
|
155
|
+
- Non-blocking: `task = swarm.execute("Build auth", wait: false)` then `task.stop`
|
|
156
|
+
- **Files**: `lib/swarm_sdk/swarm.rb` (major refactor of execute method)
|
|
157
|
+
- **Tests**: 9 comprehensive tests in `test/swarm_sdk/execute_wait_parameter_test.rb`
|
|
158
|
+
|
|
159
|
+
- **Delegation Result Event Reconstruction**: Snapshot/restore now handles delegation events properly
|
|
160
|
+
- **`delegation_result` event support**: EventsToMessages reconstructs tool result messages from delegations
|
|
161
|
+
- **Proper conversation restoration**: Delegations correctly reconstructed from event logs
|
|
162
|
+
- **Snapshot compatibility**: Enables complete state restoration including delegation history
|
|
163
|
+
- **Files**: `lib/swarm_sdk/events_to_messages.rb`
|
|
164
|
+
|
|
12
165
|
- **User Prompt Source Tracking**: `user_prompt` events now include source information to distinguish user interactions from delegations
|
|
13
166
|
- **`source` field**: Indicates origin of prompt - `"user"` (direct user interaction) or `"delegation"` (from delegation tool)
|
|
14
167
|
- **Event filtering**: Enables filtering user prompts by source in logs and analytics
|
|
@@ -36,7 +189,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
36
189
|
- **Example**: `agent(:planner).tools(:Think, :Read)` in planning node, `agent(:planner).tools(:Write, :Edit, :Bash)` in implementation node
|
|
37
190
|
- **Implementation**: New `tools(*tool_names)` method on `AgentConfig`, stored in node configuration as tool override
|
|
38
191
|
- **Backward compatible**: Omit `.tools()` to use agent's global tool configuration
|
|
39
|
-
- **Files**: `lib/swarm_sdk/
|
|
192
|
+
- **Files**: `lib/swarm_sdk/workflow/agent_config.rb`, `lib/swarm_sdk/workflow/node_builder.rb`, `lib/swarm_sdk/workflow.rb`
|
|
193
|
+
|
|
194
|
+
### Changed
|
|
195
|
+
|
|
196
|
+
- **BREAKING: Delegation Tool Rebranding**: Delegation tools renamed to emphasize collaboration over task delegation
|
|
197
|
+
- **Tool naming**: `DelegateTaskToBackend` → `WorkWithBackend`
|
|
198
|
+
- **Tool parameter**: `task:` → `message:` (more flexible, supports questions and collaboration)
|
|
199
|
+
- **Tool description**: Now emphasizes working with agents, not just delegating tasks
|
|
200
|
+
- **Configurable prefix**: Added `TOOL_NAME_PREFIX` constant for easy customization
|
|
201
|
+
- **Migration**: Update code/tests using `DelegateTaskTo*` to use `WorkWith*`
|
|
202
|
+
- **Parameter migration**: Change `task:` parameter to `message:` in delegation tool calls
|
|
203
|
+
- **Rationale**: Better reflects collaborative agent relationships and flexible communication patterns
|
|
204
|
+
- **Files affected**: `lib/swarm_sdk/tools/delegate.rb`, `lib/swarm_sdk/agent/chat/context_tracker.rb`, `lib/swarm_sdk/swarm/agent_initializer.rb`, `lib/swarm_cli/interactive_repl.rb`
|
|
205
|
+
- **Tests updated**: All delegation tests updated to use new naming (18 files)
|
|
206
|
+
|
|
207
|
+
### Fixed
|
|
208
|
+
|
|
209
|
+
- **MCP Configuration for Non-OAuth Servers**: Fixed errors when configuring MCP servers without OAuth
|
|
210
|
+
- **Issue**: OAuth field was included in streamable config even when not configured, causing errors
|
|
211
|
+
- **Fix**: Removed `oauth` field from streamable config hash
|
|
212
|
+
- **Additional fix**: Only include `rate_limit` if explicitly configured (avoid nil values)
|
|
213
|
+
- **Impact**: MCP servers without OAuth now configure correctly without errors
|
|
214
|
+
- **Files**: `lib/swarm_sdk/swarm/mcp_configurator.rb`
|
|
40
215
|
|
|
41
216
|
## [2.2.0] - 2025-11-06
|
|
42
217
|
|
|
@@ -158,7 +333,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
158
333
|
- Enables calculating total cost/tokens for a single execution
|
|
159
334
|
- Allows building complete execution traces across all agents and tools
|
|
160
335
|
- **`swarm_id`**: Identifies which swarm/node emitted the event
|
|
161
|
-
- Hierarchical format for
|
|
336
|
+
- Hierarchical format for Workflow nodes (e.g., `workflow/node:planning`)
|
|
162
337
|
- Tracks execution flow through nested swarms and workflow stages
|
|
163
338
|
- **`parent_swarm_id`**: Identifies the parent swarm for nested execution contexts
|
|
164
339
|
- **Fiber-local storage implementation**: Uses Ruby 3.2+ Fiber storage for automatic propagation
|
|
@@ -203,7 +378,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
203
378
|
- **Tool state isolation**: TodoWrite, ReadTracker, and other stateful tools isolated per instance
|
|
204
379
|
- **Nested delegation support**: Works correctly with multi-level delegation chains
|
|
205
380
|
- **Fiber-safe concurrency**: Added `Async::Semaphore` to `Chat.ask()` to prevent message corruption when multiple delegation instances call shared agents in parallel
|
|
206
|
-
- **Atomic caching**:
|
|
381
|
+
- **Atomic caching**: Workflow caches delegation instances together with primary agents for context preservation
|
|
207
382
|
- **Agent name validation**: Agent names cannot contain '@' character (reserved for delegation instances)
|
|
208
383
|
- **Automatic deduplication**: Duplicate entries in `delegates_to` are automatically removed
|
|
209
384
|
- **Comprehensive test coverage**: 17 new tests covering isolated mode, shared mode, nested delegation, cleanup, and more
|
|
@@ -343,7 +518,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
343
518
|
- **Context Preservation Across Nodes**: `reset_context` parameter for node agents
|
|
344
519
|
- `agent(:name, reset_context: false)` preserves conversation history across nodes
|
|
345
520
|
- Default: `reset_context: true` (fresh context for each node - safe default)
|
|
346
|
-
-
|
|
521
|
+
- Workflow caches and reuses agent instances when `reset_context: false`
|
|
347
522
|
- Enables stateful workflows where agents remember previous node conversations
|
|
348
523
|
- Perfect for iterative refinement, self-reflection loops, and chain-of-thought reasoning
|
|
349
524
|
|
|
@@ -359,15 +534,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
359
534
|
- Removes memory-specific code from SwarmSDK core (moved to SwarmMemory plugin)
|
|
360
535
|
- Maintains backward compatibility - permissions remain in core SDK (not plugin-specific)
|
|
361
536
|
- Enables clean separation between core SDK and plugin features (memory, skills, etc.)
|
|
362
|
-
- Plugins can preserve their configuration when agents are cloned in
|
|
537
|
+
- Plugins can preserve their configuration when agents are cloned in Workflow
|
|
363
538
|
|
|
364
|
-
- **
|
|
539
|
+
- **Workflow**: Configurable scratchpad sharing modes
|
|
365
540
|
- `scratchpad: :enabled` - Share scratchpad across all nodes
|
|
366
541
|
- `scratchpad: :per_node` - Isolated scratchpad per node
|
|
367
542
|
- `scratchpad: :disabled` - No scratchpad tools (default)
|
|
368
543
|
|
|
369
|
-
- **CLI ConfigLoader**: Accepts both Swarm and
|
|
370
|
-
- Bug fix: CLI now correctly handles
|
|
544
|
+
- **CLI ConfigLoader**: Accepts both Swarm and Workflow instances
|
|
545
|
+
- Bug fix: CLI now correctly handles Workflow execution
|
|
371
546
|
- Enables node workflows to work seamlessly with CLI commands
|
|
372
547
|
|
|
373
548
|
- **Error handling in Agent::Chat**: More robust exception handling
|
data/docs/v2/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SwarmSDK, SwarmCLI & SwarmMemory Documentation
|
|
2
2
|
|
|
3
|
-
**Version 2.
|
|
3
|
+
**Version 2.3**
|
|
4
4
|
|
|
5
5
|
Welcome to the official documentation for SwarmSDK, SwarmCLI, and SwarmMemory - a Ruby framework for orchestrating multiple AI agents as a collaborative team with persistent memory.
|
|
6
6
|
|
|
@@ -337,10 +337,15 @@ A persistent memory system for agents with semantic search capabilities:
|
|
|
337
337
|
All documentation in this directory follows these principles:
|
|
338
338
|
|
|
339
339
|
✅ **100% Accurate** - All information verified against source code
|
|
340
|
+
|
|
340
341
|
✅ **Comprehensive** - Every feature documented
|
|
342
|
+
|
|
341
343
|
✅ **Progressive** - Simple → Intermediate → Advanced
|
|
344
|
+
|
|
342
345
|
✅ **Practical** - Real-world examples throughout
|
|
346
|
+
|
|
343
347
|
✅ **Both Formats** - YAML and Ruby DSL for everything
|
|
348
|
+
|
|
344
349
|
✅ **User-Focused** - Written for developers using SwarmSDK, not implementers
|
|
345
350
|
|
|
346
351
|
---
|
|
@@ -930,12 +930,12 @@ swarm:
|
|
|
930
930
|
**How delegation works**:
|
|
931
931
|
1. You send task to `developer`
|
|
932
932
|
2. Developer writes code using Write tool
|
|
933
|
-
3. Developer calls `
|
|
933
|
+
3. Developer calls `WorkWithReviewer(message: "Review this code")`
|
|
934
934
|
4. Reviewer analyzes code and returns feedback
|
|
935
935
|
5. Developer receives feedback and can iterate
|
|
936
936
|
6. Developer returns final result to you
|
|
937
937
|
|
|
938
|
-
**The delegation tool**: When you configure `delegates_to: [reviewer]`, the developer automatically gets a `
|
|
938
|
+
**The delegation tool**: When you configure `delegates_to: [reviewer]`, the developer automatically gets a `WorkWithReviewer` tool.
|
|
939
939
|
|
|
940
940
|
### 3.2 Multi-Level Delegation
|
|
941
941
|
|
|
@@ -124,10 +124,10 @@ An **agent** is an AI with specific capabilities and constraints:
|
|
|
124
124
|
|
|
125
125
|
Delegation is how agents collaborate. When an agent is configured with `delegates_to: [other_agent]`, it gains a special delegation tool.
|
|
126
126
|
|
|
127
|
-
**Delegation tool naming**: Tools are named `
|
|
128
|
-
- `delegates_to: [reviewer]` → creates `
|
|
129
|
-
- `delegates_to: [backend]` → creates `
|
|
130
|
-
- `delegates_to: [qa_tester]` → creates `
|
|
127
|
+
**Delegation tool naming**: Tools are named `WorkWith{AgentName}` where AgentName is capitalized. For example:
|
|
128
|
+
- `delegates_to: [reviewer]` → creates `WorkWithReviewer` tool
|
|
129
|
+
- `delegates_to: [backend]` → creates `WorkWithBackend` tool
|
|
130
|
+
- `delegates_to: [qa_tester]` → creates `WorkWithQa_tester` tool
|
|
131
131
|
|
|
132
132
|
**Example flow**:
|
|
133
133
|
1. You send "Build a login page" to the **lead** agent
|
|
@@ -750,7 +750,7 @@ swarm = SwarmSDK.load_file('swarm.yml')
|
|
|
750
750
|
result = swarm.execute("Write a function to validate email addresses and get it reviewed")
|
|
751
751
|
```
|
|
752
752
|
|
|
753
|
-
**How delegation works**: The coder writes code, then calls the `
|
|
753
|
+
**How delegation works**: The coder writes code, then calls the `WorkWithReviewer` tool to get feedback. The reviewer analyzes and returns suggestions. The coder can iterate based on feedback.
|
|
754
754
|
|
|
755
755
|
### Using Multiple Tools
|
|
756
756
|
|
|
@@ -1026,7 +1026,7 @@ swarm = SwarmSDK.build do
|
|
|
1026
1026
|
model "gpt-4"
|
|
1027
1027
|
end
|
|
1028
1028
|
end
|
|
1029
|
-
# Leader won't have
|
|
1029
|
+
# Leader won't have WorkWithHelper tool!
|
|
1030
1030
|
```
|
|
1031
1031
|
|
|
1032
1032
|
**Solution**:
|
|
@@ -1412,7 +1412,7 @@ tools :Bash # Run shell commands
|
|
|
1412
1412
|
agent :leader do
|
|
1413
1413
|
description "Coordinates work"
|
|
1414
1414
|
model "gpt-4"
|
|
1415
|
-
delegates_to :worker # Creates
|
|
1415
|
+
delegates_to :worker # Creates WorkWithWorker tool
|
|
1416
1416
|
end
|
|
1417
1417
|
|
|
1418
1418
|
agent :worker do
|