active_harness 0.2.3 → 0.2.5
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/lib/active_harness/agent.rb +9 -4
- data/lib/active_harness/pipeline.rb +13 -1
- data/lib/active_harness/tribunal.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01f74d69e91e8afbc6073f9095152f43f9e942db987357bcb912d6662eaf6423
|
|
4
|
+
data.tar.gz: e984545ee51b3fd4f9b2d98f09c767e35a81a137324b6c867366220207e2bce5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b505afe51d47e4567df0fb0114c12c30ff838193cc958ae7ca10f94d466949295e86b296ea3d7681a6d616f3c358f3f3f738bd9e3b5707104130bb48933d674
|
|
7
|
+
data.tar.gz: 8f9d550df43a425e424b0144bcb38bd2be89da9b56b554926561155dc2f973e084dd0408c590c1a98543c0d6ea9e79b13347c3cc746942adc651868df311e2dc
|
data/lib/active_harness/agent.rb
CHANGED
|
@@ -12,7 +12,7 @@ module ActiveHarness
|
|
|
12
12
|
# SupportAgent.call(input: "Hi", context: { user_id: 42 })
|
|
13
13
|
# SupportAgent.call(input: "Hi", memory: memory)
|
|
14
14
|
def call(input: nil, context: {}, models: nil, memory: nil, stream: nil)
|
|
15
|
-
new(input: input, context: context, models: models, memory: memory, stream: stream).call
|
|
15
|
+
new(input: input, context: context, models: models, memory: memory, stream: stream).call.result
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Each subclass gets its own isolated config hash.
|
|
@@ -28,8 +28,13 @@ module ActiveHarness
|
|
|
28
28
|
# -------------------------------------------------------------------------
|
|
29
29
|
# Instance API
|
|
30
30
|
# -------------------------------------------------------------------------
|
|
31
|
-
attr_accessor :input
|
|
32
|
-
attr_reader :
|
|
31
|
+
attr_accessor :input, :context
|
|
32
|
+
attr_reader :result
|
|
33
|
+
|
|
34
|
+
def models=(list)
|
|
35
|
+
@models_override = Array(list)
|
|
36
|
+
@model_list_proxy = nil
|
|
37
|
+
end
|
|
33
38
|
|
|
34
39
|
def initialize(input: nil, context: {}, models: nil, memory: nil, stream: nil)
|
|
35
40
|
@input = input
|
|
@@ -64,7 +69,7 @@ module ActiveHarness
|
|
|
64
69
|
save_to_memory(result)
|
|
65
70
|
run_hook(:after_call, result)
|
|
66
71
|
@result = result
|
|
67
|
-
return
|
|
72
|
+
return self
|
|
68
73
|
rescue *RETRYABLE_ERRORS => e
|
|
69
74
|
elapsed = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0).round(3)
|
|
70
75
|
attempts << attempt_entry(entry, e, elapsed)
|
|
@@ -122,6 +122,12 @@ module ActiveHarness
|
|
|
122
122
|
# -------------------------------------------------------------------------
|
|
123
123
|
attr_reader :original_input, :output, :stopped_at, :stop_reason,
|
|
124
124
|
:execution_time, :step_results, :context
|
|
125
|
+
attr_writer :context
|
|
126
|
+
|
|
127
|
+
def input=(value)
|
|
128
|
+
@original_input = value
|
|
129
|
+
@payload = value
|
|
130
|
+
end
|
|
125
131
|
|
|
126
132
|
def initialize(input:, context: {}, memory: nil)
|
|
127
133
|
@original_input = input
|
|
@@ -189,7 +195,13 @@ module ActiveHarness
|
|
|
189
195
|
private
|
|
190
196
|
|
|
191
197
|
def execute_step(step)
|
|
192
|
-
step.agent_class.new(input: @payload, context: @context.dup)
|
|
198
|
+
agent = step.agent_class.new(input: @payload, context: @context.dup)
|
|
199
|
+
if agent.is_a?(ActiveHarness::Agent)
|
|
200
|
+
agent.call.result
|
|
201
|
+
else
|
|
202
|
+
# Tribunal — call returns self, expose via .itself
|
|
203
|
+
agent.call
|
|
204
|
+
end
|
|
193
205
|
end
|
|
194
206
|
|
|
195
207
|
# Global hook: receives (step_name, data)
|
|
@@ -94,7 +94,7 @@ module ActiveHarness
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
attr_accessor :input
|
|
97
|
+
attr_accessor :input, :context
|
|
98
98
|
attr_reader :results, :errors, :verdict, :execution_time, :agent_execution_times
|
|
99
99
|
|
|
100
100
|
def initialize(input: nil, context: {}, agents: nil, timeout: 7)
|
|
@@ -159,8 +159,10 @@ module ActiveHarness
|
|
|
159
159
|
@agent_execution_times << { agent: agents[index].class.name, time: elapsed }
|
|
160
160
|
|
|
161
161
|
if future.fulfilled?
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
value = future.value
|
|
163
|
+
result = value.is_a?(ActiveHarness::Agent) ? value.result : value
|
|
164
|
+
@results << result
|
|
165
|
+
run_hook(:after_agent, result)
|
|
164
166
|
elsif future.incomplete?
|
|
165
167
|
error = Errors::TimeoutError.new(
|
|
166
168
|
"Agent #{agents[index].class.name} timed out after #{@timeout}s"
|