Class: SwarmSDK::StateSnapshot
- Inherits:
-
Object
- Object
- SwarmSDK::StateSnapshot
- Defined in:
- lib/swarm_sdk/state_snapshot.rb
Overview
Creates snapshots of swarm/workflow conversation state
Unified implementation that works for both Swarm and Workflow. Captures conversation history, context state, scratchpad contents, and read tracking information.
The snapshot is a plain Ruby hash that can be serialized to JSON or any other format. Configuration (agent definitions, tools, prompts) stays in your YAML/DSL and is not included in snapshots.
Instance Method Summary collapse
-
#initialize(orchestration) ⇒ StateSnapshot
constructor
Initialize snapshot creator.
-
#snapshot ⇒ Snapshot
Create snapshot of current state.
Constructor Details
#initialize(orchestration) ⇒ StateSnapshot
Initialize snapshot creator
29 30 31 |
# File 'lib/swarm_sdk/state_snapshot.rb', line 29 def initialize(orchestration) @orchestration = orchestration end |
Instance Method Details
#snapshot ⇒ Snapshot
Create snapshot of current state
Returns a Snapshot object that encapsulates the snapshot data with convenient methods for serialization and file I/O.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/swarm_sdk/state_snapshot.rb', line 39 def snapshot data = { version: "2.1.0", # Bumped for plugin state abstraction type: type_name, snapshot_at: Time.now.utc.iso8601, swarm_sdk_version: SwarmSDK::VERSION, metadata: , agents: snapshot_agents, delegation_instances: snapshot_delegation_instances, scratchpad: snapshot_scratchpad, read_tracking: snapshot_read_tracking, plugin_states: snapshot_plugin_states, } # Wrap in Snapshot object SwarmSDK::Snapshot.new(data) end |