active_harness 0.2.4 → 0.2.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c32abcde2f732633681db8c314c0066d668a6e90818d0bb10324f7c4fcb26f20
|
|
4
|
+
data.tar.gz: 32081332c6997ef6bc1296008b1841be30c333afa7ffd8d1701af1a7f182d718
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 469e75529882ee17fb2610aad11823fab222cd3c060cb6a583990e1b22c4d9b8d1af5173b4158ef8ded2facb11b0ad6cb3fd9101be213e7327ca464106b720b6
|
|
7
|
+
data.tar.gz: 291624ff7f7765ae5af466d8417cee75e66596b604afefc01263771c091c738f5739dd8ead25712075e4e1a32f28252c475b62ae0942e02ce62d2eb483f42eff
|
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.
|
|
@@ -195,7 +195,13 @@ module ActiveHarness
|
|
|
195
195
|
private
|
|
196
196
|
|
|
197
197
|
def execute_step(step)
|
|
198
|
-
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
|
|
199
205
|
end
|
|
200
206
|
|
|
201
207
|
# Global hook: receives (step_name, data)
|
|
@@ -2,7 +2,7 @@ module ActiveHarness
|
|
|
2
2
|
class Railtie < Rails::Railtie
|
|
3
3
|
APP_AI_DIRS = %w[agents prompts tribunals pipelines memory].freeze
|
|
4
4
|
|
|
5
|
-
initializer "active_harness.autoload_paths" do |app|
|
|
5
|
+
initializer "active_harness.autoload_paths", before: :set_autoload_paths do |app|
|
|
6
6
|
APP_AI_DIRS.each do |dir|
|
|
7
7
|
path = Rails.root.join("app", "ai", dir)
|
|
8
8
|
app.config.autoload_paths << path.to_s if path.exist?
|
|
@@ -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"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
class AiSupportController < ApplicationController
|
|
2
2
|
include ActionController::Live
|
|
3
3
|
|
|
4
|
+
skip_before_action :verify_authenticity_token
|
|
5
|
+
|
|
4
6
|
# ---------------------------------------------------------------------------
|
|
5
7
|
# POST /ai/agent
|
|
6
8
|
# body: { input: "What is your return policy?" }
|