little_ghost 0.2.1 → 0.4.0
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/README.md +72 -74
- data/docs/guides/assemblies.md +286 -0
- data/docs/guides/core_concepts.md +159 -135
- data/docs/guides/getting_started.md +114 -83
- data/docs/guides/production.md +187 -0
- data/docs/guides/prompt_views.md +132 -0
- data/lib/little_ghost/ag_ui/adapter.rb +3 -3
- data/lib/little_ghost/agent/delegation.rb +35 -8
- data/lib/little_ghost/agent/tool_loop.rb +2 -1
- data/lib/little_ghost/agent.rb +280 -326
- data/lib/little_ghost/agent_builder.rb +20 -4
- data/lib/little_ghost/agent_factory.rb +3 -0
- data/lib/little_ghost/{agent_interruptions.rb → agent_interjections.rb} +12 -12
- data/lib/little_ghost/assembly.rb +345 -0
- data/lib/little_ghost/assembly_builder.rb +497 -0
- data/lib/little_ghost/assembly_execution.rb +535 -0
- data/lib/little_ghost/configuration.rb +263 -39
- data/lib/little_ghost/content.rb +5 -5
- data/lib/little_ghost/data_map.rb +209 -0
- data/lib/little_ghost/errors.rb +10 -2
- data/lib/little_ghost/execution.rb +206 -0
- data/lib/little_ghost/graph.rb +930 -0
- data/lib/little_ghost/message.rb +4 -4
- data/lib/little_ghost/model_resolver.rb +2 -2
- data/lib/little_ghost/prompt_resolver.rb +2 -0
- data/lib/little_ghost/run.rb +190 -64
- data/lib/little_ghost/run_context.rb +33 -20
- data/lib/little_ghost/run_result.rb +22 -11
- data/lib/little_ghost/runtime/hook.rb +9 -4
- data/lib/little_ghost/runtime.rb +134 -36
- data/lib/little_ghost/sandbox.rb +1 -1
- data/lib/little_ghost/session.rb +12 -23
- data/lib/little_ghost/session_store.rb +9 -5
- data/lib/little_ghost/session_stores/agent_core_memory.rb +64 -56
- data/lib/little_ghost/session_stores/filesystem.rb +261 -0
- data/lib/little_ghost/session_stores/memory.rb +7 -0
- data/lib/little_ghost/subagents/manager.rb +42 -42
- data/lib/little_ghost/support/executor.rb +14 -2
- data/lib/little_ghost/support/loader.rb +2 -2
- data/lib/little_ghost/support.rb +15 -3
- data/lib/little_ghost/swarm.rb +439 -0
- data/lib/little_ghost/tool.rb +88 -20
- data/lib/little_ghost/tools/write_todos.rb +6 -1
- data/lib/little_ghost/tracing/open_telemetry.rb +14 -3
- data/lib/little_ghost/unrestricted_sandbox.rb +1 -1
- data/lib/little_ghost/version.rb +1 -1
- data/lib/little_ghost/workflow.rb +224 -90
- data/lib/little_ghost.rb +36 -25
- metadata +17 -5
|
@@ -10,7 +10,7 @@ module LittleGhost
|
|
|
10
10
|
# agent_as_tool SentimentAgent, name: "classify_sentiment"
|
|
11
11
|
# end
|
|
12
12
|
#
|
|
13
|
-
# The support model receives spawn, messaging,
|
|
13
|
+
# The support model receives spawn, messaging, interjection, waiting, and
|
|
14
14
|
# listing tools for the +research+ kind. It sees the sentiment agent as one
|
|
15
15
|
# regular tool whose result is returned to the current turn.
|
|
16
16
|
#
|
|
@@ -30,7 +30,7 @@ module LittleGhost
|
|
|
30
30
|
default: Subagents::Manager::DEFAULT_WAIT_TIMEOUT
|
|
31
31
|
base.class_attribute :subagent_declarations_value, default: []
|
|
32
32
|
base.class_attribute :subagent_resolvers_value, default: []
|
|
33
|
-
base.class_attribute :
|
|
33
|
+
base.class_attribute :assembly_tool_declarations_value, default: []
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Exposes delegation declarations on agent classes.
|
|
@@ -95,25 +95,52 @@ module LittleGhost
|
|
|
95
95
|
# conversational history between calls to that tool instance.
|
|
96
96
|
def agent_as_tool(agent_class, name: nil, description: nil, model: nil, tools: nil,
|
|
97
97
|
preserve_context: false)
|
|
98
|
+
assembly_as_tool(
|
|
99
|
+
agent_class,
|
|
100
|
+
name:,
|
|
101
|
+
description:,
|
|
102
|
+
model:,
|
|
103
|
+
tools:,
|
|
104
|
+
preserve_context:
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Exposes an Agent, Workflow, Swarm, or Graph as one ordinary tool.
|
|
109
|
+
# Agent-only +model+ and +tools+ overrides are rejected for composites.
|
|
110
|
+
def assembly_as_tool(assembly_class, name: nil, description: nil, model: nil, tools: nil,
|
|
111
|
+
preserve_context: false)
|
|
112
|
+
unless assembly_class.is_a?(Class) && assembly_class <= Assembly
|
|
113
|
+
raise ConfigurationError, "Delegated assemblies must inherit from LittleGhost::Assembly"
|
|
114
|
+
end
|
|
98
115
|
validate_delegated_tools!(tools)
|
|
116
|
+
if !(assembly_class <= Agent) && (model || tools)
|
|
117
|
+
raise ConfigurationError, "Composite assemblies do not accept delegated model or tool overrides"
|
|
118
|
+
end
|
|
99
119
|
declaration = {
|
|
100
|
-
|
|
101
|
-
name: (name ||
|
|
102
|
-
description: description ||
|
|
120
|
+
assembly: assembly_class,
|
|
121
|
+
name: (name || assembly_class.assembly_id).to_s,
|
|
122
|
+
description: description || assembly_class.description,
|
|
103
123
|
model:,
|
|
104
124
|
tools:,
|
|
105
125
|
preserve_context:
|
|
106
126
|
}
|
|
107
|
-
self.
|
|
127
|
+
self.assembly_tool_declarations_value = [*assembly_tool_declarations, declaration]
|
|
108
128
|
end
|
|
109
129
|
|
|
110
130
|
# Exposes several agent classes as ordinary tools with shared options.
|
|
111
131
|
def agents_as_tools(*agent_classes, **options)
|
|
112
132
|
agent_classes.each { |agent_class| agent_as_tool(agent_class, **options) }
|
|
113
|
-
|
|
133
|
+
assembly_tool_declarations
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Exposes several assembly classes as ordinary tools with shared options.
|
|
137
|
+
def assemblies_as_tools(*assembly_classes, **options)
|
|
138
|
+
assembly_classes.each { |assembly_class| assembly_as_tool(assembly_class, **options) }
|
|
139
|
+
assembly_tool_declarations
|
|
114
140
|
end
|
|
115
141
|
|
|
116
|
-
def
|
|
142
|
+
def assembly_tool_declarations = assembly_tool_declarations_value # :nodoc:
|
|
143
|
+
def agent_tool_declarations = assembly_tool_declarations # :nodoc:
|
|
117
144
|
|
|
118
145
|
private
|
|
119
146
|
|
|
@@ -176,7 +176,8 @@ module LittleGhost
|
|
|
176
176
|
replacement = Tool::ExecutionResult.new(
|
|
177
177
|
content: "#{warning}\n\n#{result.content}",
|
|
178
178
|
status: result.status,
|
|
179
|
-
error: result.error
|
|
179
|
+
error: result.error,
|
|
180
|
+
companion_content: result.companion_content
|
|
180
181
|
)
|
|
181
182
|
Support::Callbacks.replace(payload.merge(result: replacement))
|
|
182
183
|
end
|