actionagent 1.2.0 → 1.2.1
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/action_agent/engine.rb +41 -0
- data/lib/action_agent/version.rb +1 -1
- data/lib/generators/action_agent/templates/create_active_agent_dashboard_tables.rb.erb +47 -32
- data/lib/generators/action_agent/templates/create_active_agent_telemetry_traces.rb.erb +17 -4
- 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: 9d2d4c834fd9d4b7990cd9deb27061d5b56e25e1379ae66c1b7251c0c890b645
|
|
4
|
+
data.tar.gz: 84903be1227333260c6b7b90079c4a67f1d5fc60c07bafc6b28651b81b8804cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d11a547b4172f715efa0a16c3da0f548e06ff17ac2b7c7524b9a696d16a4f1248123ca9d2f859187862112b1b3fbfdafd73a556891eaf4bcd810492eb92be81f
|
|
7
|
+
data.tar.gz: bda14fd2e530157019b6b823581d08c42eb9896a4db726f1325b03b339e14f21b0e97cb003bc693e131440ed6a56d5ffca7f330ba147ddcf8d89a77994fedc85
|
data/lib/action_agent/engine.rb
CHANGED
|
@@ -26,6 +26,47 @@ module ActionAgent
|
|
|
26
26
|
app.config.filter_parameters += [ :credential, :api_key, :access_token ]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# The controllers under app/controllers/action_agent/api are ActionAgent::Api,
|
|
30
|
+
# but an engine's files are autoloaded by the host's `rails.main` loader,
|
|
31
|
+
# under the host's inflections. A host that declares `inflect.acronym "API"`
|
|
32
|
+
# — common enough that Rails documents it — makes Zeitwerk expect
|
|
33
|
+
# ActionAgent::API::TracesController in a file that defines
|
|
34
|
+
# ActionAgent::Api::TracesController, and every request to the mount raises
|
|
35
|
+
# Zeitwerk::NameError.
|
|
36
|
+
#
|
|
37
|
+
# Scoped to this engine's own path rather than set through `inflect`: the
|
|
38
|
+
# loader is shared, so a blanket rule would re-spell the host's own API
|
|
39
|
+
# constants. `camelize` receives the absolute path, which is the only hook
|
|
40
|
+
# that can tell this engine's api/ from the host's.
|
|
41
|
+
initializer "action_agent.inflections", before: :set_autoload_paths do
|
|
42
|
+
engine_root = root.to_s
|
|
43
|
+
|
|
44
|
+
Rails.autoloaders.main.inflector.singleton_class.prepend(Module.new do
|
|
45
|
+
define_method(:camelize) do |basename, abspath|
|
|
46
|
+
next "Api" if basename == "api" && abspath.to_s.start_with?(engine_root)
|
|
47
|
+
|
|
48
|
+
super(basename, abspath)
|
|
49
|
+
end
|
|
50
|
+
end)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Rails resolves a route's controller by camelizing the stored path
|
|
54
|
+
# ("action_agent/api/traces") with the host's *global* inflections, and no
|
|
55
|
+
# engine-level setting scopes that — so an acronym host looks up
|
|
56
|
+
# ActionAgent::API::TracesController and raises NameError even though the
|
|
57
|
+
# autoloader named the module correctly above. No single spelling satisfies
|
|
58
|
+
# both kinds of host: a plain host camelizes to Api, an acronym host to API.
|
|
59
|
+
# So the namespace answers to both. `const_missing` rather than an eager
|
|
60
|
+
# alias because the controllers are autoloaded on demand, and naming them at
|
|
61
|
+
# boot would load the whole dashboard.
|
|
62
|
+
ActionAgent.singleton_class.prepend(Module.new do
|
|
63
|
+
def const_missing(name)
|
|
64
|
+
return const_get(:Api) if name == :API
|
|
65
|
+
|
|
66
|
+
super
|
|
67
|
+
end
|
|
68
|
+
end)
|
|
69
|
+
|
|
29
70
|
initializer "action_agent.assets", before: :append_assets_path do |app|
|
|
30
71
|
builds = root.join("app", "assets", "builds").to_s
|
|
31
72
|
next unless File.directory?(builds)
|
data/lib/action_agent/version.rb
CHANGED
|
@@ -26,13 +26,13 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
26
26
|
t.string :agent_class_name
|
|
27
27
|
t.string :action_name
|
|
28
28
|
t.integer :status, default: 0, null: false
|
|
29
|
-
t.column :appearance, json_type,
|
|
30
|
-
t.column :instruction_sets, json_type,
|
|
31
|
-
t.column :tools, json_type,
|
|
32
|
-
t.column :mcp_servers, json_type,
|
|
33
|
-
t.column :model_config, json_type,
|
|
34
|
-
t.column :response_format, json_type,
|
|
35
|
-
t.column :action_prompts, json_type,
|
|
29
|
+
t.column :appearance, json_type, **json_default({})
|
|
30
|
+
t.column :instruction_sets, json_type, **json_default([])
|
|
31
|
+
t.column :tools, json_type, **json_default([])
|
|
32
|
+
t.column :mcp_servers, json_type, **json_default([])
|
|
33
|
+
t.column :model_config, json_type, **json_default({})
|
|
34
|
+
t.column :response_format, json_type, **json_default({})
|
|
35
|
+
t.column :action_prompts, json_type, **json_default([], null: false)
|
|
36
36
|
|
|
37
37
|
# Agents discovered from reported telemetry rather than authored here.
|
|
38
38
|
t.string :service_name
|
|
@@ -52,7 +52,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
52
52
|
create_table "#{prefix}agent_versions" do |t|
|
|
53
53
|
t.bigint :agent_id, null: false
|
|
54
54
|
t.integer :version_number, default: 1, null: false
|
|
55
|
-
t.column :configuration_snapshot, json_type,
|
|
55
|
+
t.column :configuration_snapshot, json_type, **json_default({}, null: false)
|
|
56
56
|
t.string :change_summary
|
|
57
57
|
t.string :created_by
|
|
58
58
|
t.timestamps
|
|
@@ -65,10 +65,10 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
65
65
|
t.string :action_name
|
|
66
66
|
t.integer :status, default: 0, null: false
|
|
67
67
|
t.text :input_prompt
|
|
68
|
-
t.column :input_params, json_type,
|
|
68
|
+
t.column :input_params, json_type, **json_default({})
|
|
69
69
|
t.text :output
|
|
70
|
-
t.column :output_metadata, json_type,
|
|
71
|
-
t.column :logs, json_type,
|
|
70
|
+
t.column :output_metadata, json_type, **json_default({})
|
|
71
|
+
t.column :logs, json_type, **json_default([])
|
|
72
72
|
t.text :error_message
|
|
73
73
|
t.text :error_backtrace
|
|
74
74
|
t.integer :input_tokens
|
|
@@ -93,11 +93,11 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
93
93
|
t.string :model, default: "gpt-4o-mini"
|
|
94
94
|
t.text :instructions
|
|
95
95
|
t.string :preset_type
|
|
96
|
-
t.column :appearance, json_type,
|
|
97
|
-
t.column :instruction_sets, json_type,
|
|
98
|
-
t.column :tools, json_type,
|
|
99
|
-
t.column :mcp_servers, json_type,
|
|
100
|
-
t.column :model_config, json_type,
|
|
96
|
+
t.column :appearance, json_type, **json_default({})
|
|
97
|
+
t.column :instruction_sets, json_type, **json_default([])
|
|
98
|
+
t.column :tools, json_type, **json_default([])
|
|
99
|
+
t.column :mcp_servers, json_type, **json_default({})
|
|
100
|
+
t.column :model_config, json_type, **json_default({})
|
|
101
101
|
t.boolean :featured, default: false
|
|
102
102
|
t.boolean :free_tier, default: false
|
|
103
103
|
t.boolean :public, default: true
|
|
@@ -114,7 +114,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
114
114
|
t.string :contextable_type
|
|
115
115
|
t.bigint :contextable_id
|
|
116
116
|
t.text :instructions
|
|
117
|
-
t.column :options, json_type,
|
|
117
|
+
t.column :options, json_type, **json_default({})
|
|
118
118
|
t.string :trace_id
|
|
119
119
|
t.integer :total_input_tokens, default: 0
|
|
120
120
|
t.integer :total_output_tokens, default: 0
|
|
@@ -130,11 +130,11 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
130
130
|
t.string :content_checksum
|
|
131
131
|
t.string :tool_call_id
|
|
132
132
|
t.string :tool_name
|
|
133
|
-
t.column :tool_arguments, json_type,
|
|
133
|
+
t.column :tool_arguments, json_type, **json_default({})
|
|
134
134
|
t.column :tool_result, json_type
|
|
135
|
-
t.column :attachments, json_type,
|
|
136
|
-
t.column :metadata, json_type,
|
|
137
|
-
t.column :provenance, json_type,
|
|
135
|
+
t.column :attachments, json_type, **json_default([])
|
|
136
|
+
t.column :metadata, json_type, **json_default({})
|
|
137
|
+
t.column :provenance, json_type, **json_default({})
|
|
138
138
|
t.timestamps
|
|
139
139
|
t.index :agent_context_id
|
|
140
140
|
end
|
|
@@ -150,9 +150,9 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
150
150
|
t.integer :cached_tokens, default: 0
|
|
151
151
|
t.integer :reasoning_tokens, default: 0
|
|
152
152
|
t.float :duration_seconds
|
|
153
|
-
t.column :tool_calls, json_type,
|
|
153
|
+
t.column :tool_calls, json_type, **json_default([])
|
|
154
154
|
t.column :raw_response, json_type
|
|
155
|
-
t.column :provenance, json_type,
|
|
155
|
+
t.column :provenance, json_type, **json_default({})
|
|
156
156
|
t.string :trace_id
|
|
157
157
|
t.timestamps
|
|
158
158
|
t.index :agent_context_id
|
|
@@ -183,8 +183,8 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
183
183
|
t.string :judge_kind, default: "rules", null: false
|
|
184
184
|
t.string :judge_model
|
|
185
185
|
t.integer :sample_size, default: 20, null: false
|
|
186
|
-
t.column :criteria, json_type,
|
|
187
|
-
t.column :config, json_type,
|
|
186
|
+
t.column :criteria, json_type, **json_default([], null: false)
|
|
187
|
+
t.column :config, json_type, **json_default({}, null: false)
|
|
188
188
|
t.timestamps
|
|
189
189
|
t.index [ :agent_id, :name ], unique: true
|
|
190
190
|
end
|
|
@@ -192,7 +192,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
192
192
|
create_table "#{prefix}evaluation_runs" do |t|
|
|
193
193
|
t.bigint :evaluation_id, null: false
|
|
194
194
|
t.integer :status, default: 0, null: false
|
|
195
|
-
t.column :scores, json_type,
|
|
195
|
+
t.column :scores, json_type, **json_default({})
|
|
196
196
|
t.integer :samples_evaluated, default: 0
|
|
197
197
|
t.integer :samples_passed, default: 0
|
|
198
198
|
t.text :error_message
|
|
@@ -208,11 +208,11 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
208
208
|
t.string :sandbox_type, default: "playwright_mcp"
|
|
209
209
|
t.string :cloud_run_job_id
|
|
210
210
|
t.string :cloud_run_url
|
|
211
|
-
t.column :runs, json_type,
|
|
211
|
+
t.column :runs, json_type, **json_default([])
|
|
212
212
|
# MCP servers this session was started with, so the MCP Services view
|
|
213
213
|
# can show a launched server as running rather than offering to start
|
|
214
214
|
# a second copy.
|
|
215
|
-
t.column :mcp_servers, json_type,
|
|
215
|
+
t.column :mcp_servers, json_type, **json_default([])
|
|
216
216
|
t.integer :runs_count, default: 0
|
|
217
217
|
t.integer :max_runs, default: 10
|
|
218
218
|
t.integer :timeout_seconds, default: 300
|
|
@@ -234,7 +234,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
234
234
|
t.integer :status, default: 0, null: false
|
|
235
235
|
t.text :result
|
|
236
236
|
t.text :error
|
|
237
|
-
t.column :screenshots, json_type,
|
|
237
|
+
t.column :screenshots, json_type, **json_default([])
|
|
238
238
|
t.integer :tokens_used, default: 0
|
|
239
239
|
t.integer :duration_ms
|
|
240
240
|
t.datetime :started_at
|
|
@@ -250,7 +250,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
250
250
|
t.integer :status, default: 0, null: false
|
|
251
251
|
t.integer :action_count, default: 0
|
|
252
252
|
t.integer :duration_ms
|
|
253
|
-
t.column :metadata, json_type,
|
|
253
|
+
t.column :metadata, json_type, **json_default({})
|
|
254
254
|
t.bigint :user_id
|
|
255
255
|
t.bigint :account_id
|
|
256
256
|
t.timestamps
|
|
@@ -269,7 +269,7 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
269
269
|
t.integer :timestamp_ms, null: false
|
|
270
270
|
t.string :screenshot_key
|
|
271
271
|
t.string :dom_snapshot_key
|
|
272
|
-
t.column :metadata, json_type,
|
|
272
|
+
t.column :metadata, json_type, **json_default({})
|
|
273
273
|
t.timestamps
|
|
274
274
|
t.index [ :session_recording_id, :sequence ], unique: true,
|
|
275
275
|
name: "index_active_agent_recording_actions_on_recording_and_sequence"
|
|
@@ -314,6 +314,21 @@ class CreateActiveAgentDashboardTables < ActiveRecord::Migration<%= migration_ve
|
|
|
314
314
|
|
|
315
315
|
# jsonb where the adapter has it, json where it doesn't.
|
|
316
316
|
def json_type
|
|
317
|
-
@json_type ||=
|
|
317
|
+
@json_type ||= postgres? ? :jsonb : :json
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# MySQL rejects a default on a JSON column outright ("BLOB, TEXT, GEOMETRY or
|
|
321
|
+
# JSON column can't have a default value"), which aborts create_table, so the
|
|
322
|
+
# column is created without one there. `null: false` is dropped with it:
|
|
323
|
+
# nothing assigns these before validation, so a NOT NULL column with no
|
|
324
|
+
# default would reject the very inserts the default was there to satisfy.
|
|
325
|
+
def json_default(value, null: nil)
|
|
326
|
+
return {} unless postgres?
|
|
327
|
+
|
|
328
|
+
null.nil? ? { default: value } : { default: value, null: null }
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def postgres?
|
|
332
|
+
connection.adapter_name.to_s.downcase.include?("postgres")
|
|
318
333
|
end
|
|
319
334
|
end
|
|
@@ -15,9 +15,9 @@ class CreateActiveAgentTelemetryTraces < ActiveRecord::Migration<%= migration_ve
|
|
|
15
15
|
t.string :service_name
|
|
16
16
|
t.string :environment
|
|
17
17
|
t.datetime :timestamp, index: true
|
|
18
|
-
t.column :spans, json_type,
|
|
19
|
-
t.column :resource_attributes, json_type,
|
|
20
|
-
t.column :sdk_info, json_type,
|
|
18
|
+
t.column :spans, json_type, **json_default([])
|
|
19
|
+
t.column :resource_attributes, json_type, **json_default({})
|
|
20
|
+
t.column :sdk_info, json_type, **json_default({})
|
|
21
21
|
t.decimal :total_duration_ms, precision: 12, scale: 3
|
|
22
22
|
t.integer :total_input_tokens, default: 0
|
|
23
23
|
t.integer :total_output_tokens, default: 0
|
|
@@ -53,6 +53,19 @@ class CreateActiveAgentTelemetryTraces < ActiveRecord::Migration<%= migration_ve
|
|
|
53
53
|
# traverses spans in SQL on PostgreSQL, and jsonb_array_elements rejects a
|
|
54
54
|
# json argument, so the column type and the query have to agree.
|
|
55
55
|
def json_type
|
|
56
|
-
@json_type ||=
|
|
56
|
+
@json_type ||= postgres? ? :jsonb : :json
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# MySQL rejects a default on a JSON column outright ("BLOB, TEXT, GEOMETRY or
|
|
60
|
+
# JSON column can't have a default value"), which aborts create_table, so the
|
|
61
|
+
# column is created without one there. ActionAgent::TelemetryTrace reads every
|
|
62
|
+
# JSON column through `Array(...)`/`|| {}`, and ingest always assigns all
|
|
63
|
+
# three, so a NULL reads the same as the empty default would.
|
|
64
|
+
def json_default(value)
|
|
65
|
+
postgres? ? { default: value } : {}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def postgres?
|
|
69
|
+
connection.adapter_name.to_s.downcase.include?("postgres")
|
|
57
70
|
end
|
|
58
71
|
end
|