activeagent 1.0.3 → 1.2.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/CHANGELOG.md +132 -0
- data/README.md +39 -3
- data/lib/active_agent/base.rb +4 -0
- data/lib/active_agent/model_capabilities.rb +89 -0
- data/lib/active_agent/providers/_base_provider.rb +23 -2
- data/lib/active_agent/providers/concerns/exception_handler.rb +12 -1
- data/lib/active_agent/providers/errors.rb +140 -0
- data/lib/active_agent/providers/ollama/chat/transforms.rb +9 -3
- data/lib/active_agent/railtie.rb +5 -0
- data/lib/active_agent/telemetry/configuration.rb +115 -171
- data/lib/active_agent/telemetry/instrumentation.rb +141 -14
- data/lib/active_agent/telemetry/reporter.rb +12 -165
- data/lib/active_agent/telemetry/span.rb +18 -245
- data/lib/active_agent/telemetry/tool_origin.rb +90 -0
- data/lib/active_agent/telemetry/tracer.rb +67 -70
- data/lib/active_agent/telemetry.rb +2 -2
- data/lib/active_agent/version.rb +1 -1
- data/lib/active_agent.rb +1 -1
- metadata +38 -42
- data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/api/traces_controller.rb +0 -117
- data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/application_controller.rb +0 -54
- data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/dashboard_controller.rb +0 -126
- data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/traces_controller.rb +0 -103
- data/lib/active_agent/dashboard/app/jobs/active_agent/dashboard/agent_execution_job.rb +0 -56
- data/lib/active_agent/dashboard/app/jobs/active_agent/dashboard/application_job.rb +0 -14
- data/lib/active_agent/dashboard/app/jobs/active_agent/dashboard/sandbox_cleanup_job.rb +0 -49
- data/lib/active_agent/dashboard/app/jobs/active_agent/dashboard/sandbox_provision_job.rb +0 -65
- data/lib/active_agent/dashboard/app/jobs/active_agent/process_telemetry_traces_job.rb +0 -77
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/agent.rb +0 -256
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/agent_run.rb +0 -113
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/agent_template.rb +0 -208
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/agent_version.rb +0 -60
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/application_record.rb +0 -46
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb +0 -125
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_snapshot.rb +0 -83
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/sandbox_run.rb +0 -52
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/sandbox_session.rb +0 -169
- data/lib/active_agent/dashboard/app/models/active_agent/dashboard/session_recording.rb +0 -193
- data/lib/active_agent/dashboard/app/models/active_agent/telemetry_trace.rb +0 -198
- data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/_trace_detail.html.erb +0 -105
- data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/index.html.erb +0 -135
- data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/metrics.html.erb +0 -143
- data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/show.html.erb +0 -36
- data/lib/active_agent/dashboard/app/views/layouts/active_agent/dashboard/application.html.erb +0 -94
- data/lib/active_agent/dashboard/config/routes.rb +0 -78
- data/lib/active_agent/dashboard/engine.rb +0 -39
- data/lib/active_agent/dashboard.rb +0 -151
- data/lib/generators/active_agent/dashboard/install/install_generator.rb +0 -96
- data/lib/generators/active_agent/dashboard/install/templates/initializer.rb +0 -89
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_runs.rb +0 -42
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_templates.rb +0 -38
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_versions.rb +0 -22
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agents.rb +0 -53
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_sandbox_runs.rb +0 -28
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_sandbox_sessions.rb +0 -43
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_session_recordings.rb +0 -44
- data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_telemetry_traces.rb +0 -56
- data/lib/generators/active_agent/dashboard/install_generator.rb +0 -64
- data/lib/generators/active_agent/dashboard/templates/active_agent_dashboard.rb.erb +0 -30
- data/lib/generators/active_agent/dashboard/templates/create_active_agent_telemetry_traces.rb.erb +0 -30
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rails/generators"
|
|
4
|
-
require "rails/generators/active_record"
|
|
5
|
-
|
|
6
|
-
module ActiveAgent
|
|
7
|
-
module Dashboard
|
|
8
|
-
module Generators
|
|
9
|
-
# Generator for installing the ActiveAgent Dashboard engine.
|
|
10
|
-
#
|
|
11
|
-
# Usage:
|
|
12
|
-
# rails generate active_agent:dashboard:install
|
|
13
|
-
#
|
|
14
|
-
# This will:
|
|
15
|
-
# - Copy migration files for all dashboard models
|
|
16
|
-
# - Create an initializer for configuration
|
|
17
|
-
# - Add the engine mount to routes.rb
|
|
18
|
-
# - Seed default agent templates
|
|
19
|
-
#
|
|
20
|
-
class InstallGenerator < Rails::Generators::Base
|
|
21
|
-
include ActiveRecord::Generators::Migration
|
|
22
|
-
|
|
23
|
-
source_root File.expand_path("templates", __dir__)
|
|
24
|
-
|
|
25
|
-
class_option :multi_tenant, type: :boolean, default: false,
|
|
26
|
-
desc: "Configure for multi-tenant mode with account association"
|
|
27
|
-
|
|
28
|
-
class_option :skip_migrations, type: :boolean, default: false,
|
|
29
|
-
desc: "Skip copying migration files"
|
|
30
|
-
|
|
31
|
-
class_option :skip_routes, type: :boolean, default: false,
|
|
32
|
-
desc: "Skip adding route mount"
|
|
33
|
-
|
|
34
|
-
def copy_migrations
|
|
35
|
-
return if options[:skip_migrations]
|
|
36
|
-
|
|
37
|
-
migration_template "migrations/create_active_agent_agents.rb",
|
|
38
|
-
"db/migrate/create_active_agent_agents.rb"
|
|
39
|
-
|
|
40
|
-
migration_template "migrations/create_active_agent_agent_versions.rb",
|
|
41
|
-
"db/migrate/create_active_agent_agent_versions.rb"
|
|
42
|
-
|
|
43
|
-
migration_template "migrations/create_active_agent_agent_runs.rb",
|
|
44
|
-
"db/migrate/create_active_agent_agent_runs.rb"
|
|
45
|
-
|
|
46
|
-
migration_template "migrations/create_active_agent_agent_templates.rb",
|
|
47
|
-
"db/migrate/create_active_agent_agent_templates.rb"
|
|
48
|
-
|
|
49
|
-
migration_template "migrations/create_active_agent_sandbox_sessions.rb",
|
|
50
|
-
"db/migrate/create_active_agent_sandbox_sessions.rb"
|
|
51
|
-
|
|
52
|
-
migration_template "migrations/create_active_agent_sandbox_runs.rb",
|
|
53
|
-
"db/migrate/create_active_agent_sandbox_runs.rb"
|
|
54
|
-
|
|
55
|
-
migration_template "migrations/create_active_agent_session_recordings.rb",
|
|
56
|
-
"db/migrate/create_active_agent_session_recordings.rb"
|
|
57
|
-
|
|
58
|
-
migration_template "migrations/create_active_agent_telemetry_traces.rb",
|
|
59
|
-
"db/migrate/create_active_agent_telemetry_traces.rb"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def create_initializer
|
|
63
|
-
template "initializer.rb", "config/initializers/active_agent_dashboard.rb"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def mount_engine
|
|
67
|
-
return if options[:skip_routes]
|
|
68
|
-
|
|
69
|
-
route 'mount ActiveAgent::Dashboard::Engine => "/active_agent"'
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def show_post_install
|
|
73
|
-
say ""
|
|
74
|
-
say "ActiveAgent Dashboard installed!", :green
|
|
75
|
-
say ""
|
|
76
|
-
say "Next steps:"
|
|
77
|
-
say " 1. Run migrations: rails db:migrate"
|
|
78
|
-
say " 2. Seed templates: rails active_agent:dashboard:seed"
|
|
79
|
-
say " 3. Configure authentication in config/initializers/active_agent_dashboard.rb"
|
|
80
|
-
say " 4. Visit /active_agent to access the dashboard"
|
|
81
|
-
say ""
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
private
|
|
85
|
-
|
|
86
|
-
def migration_version
|
|
87
|
-
"[#{ActiveRecord::Migration.current_version}]"
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def multi_tenant?
|
|
91
|
-
options[:multi_tenant]
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# ActiveAgent Dashboard Configuration
|
|
4
|
-
#
|
|
5
|
-
# This initializer configures the ActiveAgent Dashboard engine.
|
|
6
|
-
# See https://docs.activeagents.ai/dashboard for full documentation.
|
|
7
|
-
|
|
8
|
-
ActiveAgent::Dashboard.configure do |config|
|
|
9
|
-
# ==========================================================================
|
|
10
|
-
# Authentication
|
|
11
|
-
# ==========================================================================
|
|
12
|
-
|
|
13
|
-
# Set an authentication method that will be called on all dashboard controllers.
|
|
14
|
-
# This should authenticate the user and redirect/raise if unauthorized.
|
|
15
|
-
#
|
|
16
|
-
# Examples:
|
|
17
|
-
# config.authentication_method = ->(controller) { controller.authenticate_admin! }
|
|
18
|
-
# config.authentication_method = ->(controller) { controller.authenticate_user! }
|
|
19
|
-
#
|
|
20
|
-
# config.authentication_method = nil
|
|
21
|
-
|
|
22
|
-
<% if multi_tenant? -%>
|
|
23
|
-
# ==========================================================================
|
|
24
|
-
# Multi-tenant Mode
|
|
25
|
-
# ==========================================================================
|
|
26
|
-
|
|
27
|
-
# Enable multi-tenant mode for SaaS deployments with multiple accounts.
|
|
28
|
-
config.multi_tenant = true
|
|
29
|
-
|
|
30
|
-
# The Account model class name
|
|
31
|
-
config.account_class = "Account"
|
|
32
|
-
|
|
33
|
-
# The User model class name
|
|
34
|
-
config.user_class = "User"
|
|
35
|
-
|
|
36
|
-
# Method to call on controllers to get the current account
|
|
37
|
-
config.current_account_method = :current_account
|
|
38
|
-
|
|
39
|
-
# Method to call on controllers to get the current user
|
|
40
|
-
config.current_user_method = :current_user
|
|
41
|
-
|
|
42
|
-
<% else -%>
|
|
43
|
-
# ==========================================================================
|
|
44
|
-
# Local Mode (default)
|
|
45
|
-
# ==========================================================================
|
|
46
|
-
|
|
47
|
-
# Multi-tenant mode is disabled by default.
|
|
48
|
-
# Set to true if you're building a SaaS platform with multiple accounts.
|
|
49
|
-
# config.multi_tenant = false
|
|
50
|
-
|
|
51
|
-
# Optional: Associate agents with users
|
|
52
|
-
# config.user_class = "User"
|
|
53
|
-
# config.current_user_method = :current_user
|
|
54
|
-
|
|
55
|
-
<% end -%>
|
|
56
|
-
# ==========================================================================
|
|
57
|
-
# Sandbox Configuration
|
|
58
|
-
# ==========================================================================
|
|
59
|
-
|
|
60
|
-
# Sandbox service type for agent execution environments.
|
|
61
|
-
# Options: :local (Docker/Incus), :cloud_run, :kubernetes
|
|
62
|
-
config.sandbox_service = :local
|
|
63
|
-
|
|
64
|
-
# Custom sandbox limits (optional)
|
|
65
|
-
# config.sandbox_limits = {
|
|
66
|
-
# max_runs: 10,
|
|
67
|
-
# timeout_seconds: 300,
|
|
68
|
-
# max_tokens: 50_000,
|
|
69
|
-
# session_duration_minutes: 15
|
|
70
|
-
# }
|
|
71
|
-
|
|
72
|
-
# ==========================================================================
|
|
73
|
-
# UI Configuration
|
|
74
|
-
# ==========================================================================
|
|
75
|
-
|
|
76
|
-
# Use Inertia.js with React for the frontend (requires additional setup)
|
|
77
|
-
# config.use_inertia = false
|
|
78
|
-
|
|
79
|
-
# Custom layout for dashboard views
|
|
80
|
-
# config.layout = "application"
|
|
81
|
-
|
|
82
|
-
# ==========================================================================
|
|
83
|
-
# Storage Configuration
|
|
84
|
-
# ==========================================================================
|
|
85
|
-
|
|
86
|
-
# Storage service for screenshots and snapshots.
|
|
87
|
-
# Must respond to #signed_url_for(key, expires_in:) and #fetch_snapshot(key)
|
|
88
|
-
# config.storage_service = MyStorageService.new
|
|
89
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentAgentRuns < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_agent_runs do |t|
|
|
6
|
-
t.references :agent, null: false, foreign_key: { to_table: :active_agent_agents }
|
|
7
|
-
|
|
8
|
-
# Input
|
|
9
|
-
t.text :input_prompt
|
|
10
|
-
t.jsonb :input_params, default: {}
|
|
11
|
-
|
|
12
|
-
# Output
|
|
13
|
-
t.text :output
|
|
14
|
-
t.jsonb :output_metadata, default: {}
|
|
15
|
-
|
|
16
|
-
# Execution details
|
|
17
|
-
t.integer :status, default: 0, null: false
|
|
18
|
-
t.integer :duration_ms
|
|
19
|
-
t.datetime :started_at
|
|
20
|
-
t.datetime :completed_at
|
|
21
|
-
|
|
22
|
-
# Token usage
|
|
23
|
-
t.integer :input_tokens
|
|
24
|
-
t.integer :output_tokens
|
|
25
|
-
t.integer :total_tokens
|
|
26
|
-
|
|
27
|
-
# Error tracking
|
|
28
|
-
t.text :error_message
|
|
29
|
-
t.text :error_backtrace
|
|
30
|
-
|
|
31
|
-
# Trace for debugging
|
|
32
|
-
t.string :trace_id
|
|
33
|
-
t.jsonb :logs, default: []
|
|
34
|
-
|
|
35
|
-
t.timestamps
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
add_index :active_agent_agent_runs, :status
|
|
39
|
-
add_index :active_agent_agent_runs, :trace_id
|
|
40
|
-
add_index :active_agent_agent_runs, :created_at
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentAgentTemplates < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_agent_templates do |t|
|
|
6
|
-
t.string :name, null: false
|
|
7
|
-
t.string :slug, null: false
|
|
8
|
-
t.text :description
|
|
9
|
-
t.string :category
|
|
10
|
-
|
|
11
|
-
# Template configuration (same as agents)
|
|
12
|
-
t.string :provider, default: "openai"
|
|
13
|
-
t.string :model, default: "gpt-4o-mini"
|
|
14
|
-
t.text :instructions
|
|
15
|
-
t.string :preset_type
|
|
16
|
-
t.jsonb :appearance, default: {}
|
|
17
|
-
t.jsonb :instruction_sets, default: []
|
|
18
|
-
t.jsonb :tools, default: []
|
|
19
|
-
t.jsonb :mcp_servers, default: {}
|
|
20
|
-
t.jsonb :model_config, default: {}
|
|
21
|
-
|
|
22
|
-
# Metadata
|
|
23
|
-
t.string :icon
|
|
24
|
-
t.integer :usage_count, default: 0
|
|
25
|
-
t.boolean :featured, default: false
|
|
26
|
-
t.boolean :public, default: true
|
|
27
|
-
t.boolean :free_tier, default: true
|
|
28
|
-
|
|
29
|
-
t.timestamps
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
add_index :active_agent_agent_templates, :slug, unique: true
|
|
33
|
-
add_index :active_agent_agent_templates, :category
|
|
34
|
-
add_index :active_agent_agent_templates, :featured
|
|
35
|
-
add_index :active_agent_agent_templates, :usage_count
|
|
36
|
-
add_index :active_agent_agent_templates, :free_tier
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentAgentVersions < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_agent_versions do |t|
|
|
6
|
-
t.references :agent, null: false, foreign_key: { to_table: :active_agent_agents }
|
|
7
|
-
|
|
8
|
-
t.integer :version_number, null: false, default: 1
|
|
9
|
-
t.string :change_summary
|
|
10
|
-
|
|
11
|
-
# Snapshot of agent configuration at this version
|
|
12
|
-
t.jsonb :configuration_snapshot, null: false, default: {}
|
|
13
|
-
|
|
14
|
-
# Who made the change
|
|
15
|
-
t.string :created_by
|
|
16
|
-
|
|
17
|
-
t.timestamps
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
add_index :active_agent_agent_versions, [:agent_id, :version_number], unique: true
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentAgents < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_agents do |t|
|
|
6
|
-
t.string :name, null: false
|
|
7
|
-
t.text :description
|
|
8
|
-
t.string :slug, null: false
|
|
9
|
-
|
|
10
|
-
# Agent class configuration
|
|
11
|
-
t.string :agent_class_name
|
|
12
|
-
t.string :provider, default: "openai"
|
|
13
|
-
t.string :model, default: "gpt-4o-mini"
|
|
14
|
-
|
|
15
|
-
# Instructions and system prompt
|
|
16
|
-
t.text :instructions
|
|
17
|
-
|
|
18
|
-
# Avatar/appearance configuration
|
|
19
|
-
t.string :preset_type
|
|
20
|
-
t.jsonb :appearance, default: {}
|
|
21
|
-
|
|
22
|
-
# Capabilities
|
|
23
|
-
t.jsonb :instruction_sets, default: []
|
|
24
|
-
t.jsonb :tools, default: []
|
|
25
|
-
t.jsonb :mcp_servers, default: []
|
|
26
|
-
|
|
27
|
-
# Model configuration
|
|
28
|
-
t.jsonb :model_config, default: {}
|
|
29
|
-
|
|
30
|
-
# Response format
|
|
31
|
-
t.jsonb :response_format, default: {}
|
|
32
|
-
|
|
33
|
-
# Status
|
|
34
|
-
t.integer :status, default: 0, null: false
|
|
35
|
-
|
|
36
|
-
# Owner associations (optional)
|
|
37
|
-
t.references :user, foreign_key: true, null: true
|
|
38
|
-
<% if multi_tenant? -%>
|
|
39
|
-
t.references :account, foreign_key: true, null: true
|
|
40
|
-
<% end -%>
|
|
41
|
-
|
|
42
|
-
t.timestamps
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
<% if multi_tenant? -%>
|
|
46
|
-
add_index :active_agent_agents, [:account_id, :slug], unique: true
|
|
47
|
-
<% else -%>
|
|
48
|
-
add_index :active_agent_agents, [:user_id, :slug], unique: true
|
|
49
|
-
<% end -%>
|
|
50
|
-
add_index :active_agent_agents, :status
|
|
51
|
-
add_index :active_agent_agents, :provider
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentSandboxRuns < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_sandbox_runs do |t|
|
|
6
|
-
t.references :sandbox_session, foreign_key: { to_table: :active_agent_sandbox_sessions }, null: true
|
|
7
|
-
|
|
8
|
-
t.text :task, null: false
|
|
9
|
-
t.integer :status, default: 0, null: false
|
|
10
|
-
|
|
11
|
-
# Execution details
|
|
12
|
-
t.text :result
|
|
13
|
-
t.text :error
|
|
14
|
-
t.integer :duration_ms
|
|
15
|
-
t.integer :tokens_used
|
|
16
|
-
t.datetime :started_at
|
|
17
|
-
t.datetime :completed_at
|
|
18
|
-
|
|
19
|
-
# Screenshots
|
|
20
|
-
t.jsonb :screenshots, default: []
|
|
21
|
-
|
|
22
|
-
t.timestamps
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
add_index :active_agent_sandbox_runs, :status
|
|
26
|
-
add_index :active_agent_sandbox_runs, :created_at
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentSandboxSessions < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_sandbox_sessions do |t|
|
|
6
|
-
t.string :session_id, null: false
|
|
7
|
-
t.references :user, foreign_key: true, null: true
|
|
8
|
-
<% if multi_tenant? -%>
|
|
9
|
-
t.references :account, foreign_key: true, null: true
|
|
10
|
-
<% end -%>
|
|
11
|
-
t.references :agent_template, foreign_key: { to_table: :active_agent_agent_templates }, null: true
|
|
12
|
-
|
|
13
|
-
# Session metadata
|
|
14
|
-
t.string :sandbox_type, default: "playwright_mcp"
|
|
15
|
-
t.integer :status, default: 0
|
|
16
|
-
t.string :cloud_run_job_id
|
|
17
|
-
t.string :cloud_run_url
|
|
18
|
-
|
|
19
|
-
# Execution tracking
|
|
20
|
-
t.integer :runs_count, default: 0
|
|
21
|
-
t.integer :max_runs, default: 10
|
|
22
|
-
t.integer :timeout_seconds, default: 300
|
|
23
|
-
t.datetime :expires_at
|
|
24
|
-
t.datetime :last_activity_at
|
|
25
|
-
|
|
26
|
-
# Resource usage
|
|
27
|
-
t.integer :total_tokens, default: 0
|
|
28
|
-
t.integer :total_duration_ms, default: 0
|
|
29
|
-
|
|
30
|
-
# Results
|
|
31
|
-
t.jsonb :runs, default: []
|
|
32
|
-
t.text :error_message
|
|
33
|
-
|
|
34
|
-
t.timestamps
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
add_index :active_agent_sandbox_sessions, :session_id, unique: true
|
|
38
|
-
add_index :active_agent_sandbox_sessions, :status
|
|
39
|
-
add_index :active_agent_sandbox_sessions, :sandbox_type
|
|
40
|
-
add_index :active_agent_sandbox_sessions, :expires_at
|
|
41
|
-
add_index :active_agent_sandbox_sessions, :cloud_run_job_id
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentSessionRecordings < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_session_recordings do |t|
|
|
6
|
-
t.references :agent_run, null: true, foreign_key: { to_table: :active_agent_agent_runs }
|
|
7
|
-
t.references :sandbox_session, null: true, foreign_key: { to_table: :active_agent_sandbox_sessions }
|
|
8
|
-
t.string :name
|
|
9
|
-
t.integer :status, default: 0, null: false
|
|
10
|
-
t.integer :duration_ms
|
|
11
|
-
t.integer :action_count, default: 0
|
|
12
|
-
t.jsonb :metadata, default: {}
|
|
13
|
-
t.timestamps
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
create_table :active_agent_recording_actions do |t|
|
|
17
|
-
t.references :session_recording, null: false, foreign_key: { to_table: :active_agent_session_recordings }
|
|
18
|
-
t.string :action_type, null: false
|
|
19
|
-
t.integer :sequence, null: false
|
|
20
|
-
t.integer :timestamp_ms, null: false
|
|
21
|
-
t.string :selector
|
|
22
|
-
t.text :value
|
|
23
|
-
t.string :screenshot_key
|
|
24
|
-
t.string :dom_snapshot_key
|
|
25
|
-
t.jsonb :metadata, default: {}
|
|
26
|
-
t.timestamps
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
add_index :active_agent_recording_actions, [:session_recording_id, :sequence], unique: true, name: "idx_recording_actions_on_recording_and_sequence"
|
|
30
|
-
|
|
31
|
-
create_table :active_agent_recording_snapshots do |t|
|
|
32
|
-
t.references :session_recording, null: false, foreign_key: { to_table: :active_agent_session_recordings }
|
|
33
|
-
t.references :recording_action, null: true, foreign_key: { to_table: :active_agent_recording_actions }
|
|
34
|
-
t.string :storage_key, null: false
|
|
35
|
-
t.string :snapshot_type, null: false
|
|
36
|
-
t.integer :width
|
|
37
|
-
t.integer :height
|
|
38
|
-
t.integer :file_size_bytes
|
|
39
|
-
t.timestamps
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
add_index :active_agent_recording_snapshots, :storage_key, unique: true
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentTelemetryTraces < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_telemetry_traces do |t|
|
|
6
|
-
<% if multi_tenant? -%>
|
|
7
|
-
t.references :account, foreign_key: true, null: true
|
|
8
|
-
<% end -%>
|
|
9
|
-
|
|
10
|
-
# Trace identification
|
|
11
|
-
t.string :trace_id, null: false
|
|
12
|
-
t.string :service_name
|
|
13
|
-
t.string :environment
|
|
14
|
-
|
|
15
|
-
# Timing
|
|
16
|
-
t.datetime :timestamp, null: false
|
|
17
|
-
|
|
18
|
-
# Span data (JSON array of spans)
|
|
19
|
-
t.jsonb :spans, default: []
|
|
20
|
-
|
|
21
|
-
# Resource attributes
|
|
22
|
-
t.jsonb :resource_attributes, default: {}
|
|
23
|
-
|
|
24
|
-
# SDK info
|
|
25
|
-
t.jsonb :sdk_info, default: {}
|
|
26
|
-
|
|
27
|
-
# Aggregated metrics (for quick queries)
|
|
28
|
-
t.integer :total_duration_ms
|
|
29
|
-
t.integer :total_input_tokens, default: 0
|
|
30
|
-
t.integer :total_output_tokens, default: 0
|
|
31
|
-
t.integer :total_thinking_tokens, default: 0
|
|
32
|
-
|
|
33
|
-
# Status
|
|
34
|
-
t.string :status, default: "UNSET"
|
|
35
|
-
|
|
36
|
-
# Agent info (denormalized for queries)
|
|
37
|
-
t.string :agent_class
|
|
38
|
-
t.string :agent_action
|
|
39
|
-
|
|
40
|
-
# Error info
|
|
41
|
-
t.text :error_message
|
|
42
|
-
|
|
43
|
-
t.timestamps
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
add_index :active_agent_telemetry_traces, :trace_id, unique: true
|
|
47
|
-
add_index :active_agent_telemetry_traces, :timestamp
|
|
48
|
-
add_index :active_agent_telemetry_traces, :service_name
|
|
49
|
-
add_index :active_agent_telemetry_traces, :environment
|
|
50
|
-
add_index :active_agent_telemetry_traces, :agent_class
|
|
51
|
-
add_index :active_agent_telemetry_traces, :status
|
|
52
|
-
<% if multi_tenant? -%>
|
|
53
|
-
add_index :active_agent_telemetry_traces, [:account_id, :timestamp]
|
|
54
|
-
<% end -%>
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rails/generators"
|
|
4
|
-
require "rails/generators/active_record"
|
|
5
|
-
|
|
6
|
-
module ActiveAgent
|
|
7
|
-
module Dashboard
|
|
8
|
-
# Generator for installing the ActiveAgent Dashboard.
|
|
9
|
-
#
|
|
10
|
-
# @example Run the generator
|
|
11
|
-
# rails generate active_agent:dashboard:install
|
|
12
|
-
#
|
|
13
|
-
# This will:
|
|
14
|
-
# - Create the telemetry_traces table migration
|
|
15
|
-
# - Add mount directive to routes
|
|
16
|
-
# - Create initializer for dashboard configuration
|
|
17
|
-
#
|
|
18
|
-
class InstallGenerator < Rails::Generators::Base
|
|
19
|
-
include ActiveRecord::Generators::Migration
|
|
20
|
-
|
|
21
|
-
source_root File.expand_path("templates", __dir__)
|
|
22
|
-
|
|
23
|
-
desc "Installs the ActiveAgent Dashboard with telemetry storage"
|
|
24
|
-
|
|
25
|
-
def copy_migrations
|
|
26
|
-
migration_template(
|
|
27
|
-
"create_active_agent_telemetry_traces.rb.erb",
|
|
28
|
-
"db/migrate/create_active_agent_telemetry_traces.rb"
|
|
29
|
-
)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def add_route
|
|
33
|
-
route 'mount ActiveAgent::Dashboard::Engine => "/active_agent"'
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def create_initializer
|
|
37
|
-
template(
|
|
38
|
-
"active_agent_dashboard.rb.erb",
|
|
39
|
-
"config/initializers/active_agent_dashboard.rb"
|
|
40
|
-
)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def show_readme
|
|
44
|
-
say "\n"
|
|
45
|
-
say "ActiveAgent Dashboard installed successfully!", :green
|
|
46
|
-
say "\n"
|
|
47
|
-
say "Next steps:"
|
|
48
|
-
say " 1. Run migrations: rails db:migrate"
|
|
49
|
-
say " 2. Configure telemetry in config/active_agent.yml:"
|
|
50
|
-
say " telemetry:"
|
|
51
|
-
say " enabled: true"
|
|
52
|
-
say " local_storage: true"
|
|
53
|
-
say " 3. Visit /active_agent to view the dashboard"
|
|
54
|
-
say "\n"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
private
|
|
58
|
-
|
|
59
|
-
def migration_version
|
|
60
|
-
"[#{ActiveRecord::Migration.current_version}]"
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# ActiveAgent Dashboard Configuration
|
|
4
|
-
#
|
|
5
|
-
# This file configures the ActiveAgent telemetry dashboard.
|
|
6
|
-
# The dashboard is mounted at /active_agent by default.
|
|
7
|
-
|
|
8
|
-
ActiveAgent::Dashboard.configure do |config|
|
|
9
|
-
# Authentication method - provide a lambda that receives the controller
|
|
10
|
-
# and performs authentication. Return false or raise to deny access.
|
|
11
|
-
#
|
|
12
|
-
# Examples:
|
|
13
|
-
#
|
|
14
|
-
# Basic auth:
|
|
15
|
-
# config.authentication_method = ->(controller) {
|
|
16
|
-
# controller.authenticate_or_request_with_http_basic do |username, password|
|
|
17
|
-
# username == "admin" && password == Rails.application.credentials.dashboard_password
|
|
18
|
-
# end
|
|
19
|
-
# }
|
|
20
|
-
#
|
|
21
|
-
# Devise:
|
|
22
|
-
# config.authentication_method = ->(controller) {
|
|
23
|
-
# controller.authenticate_admin!
|
|
24
|
-
# }
|
|
25
|
-
#
|
|
26
|
-
# No authentication (development only!):
|
|
27
|
-
# config.authentication_method = nil
|
|
28
|
-
#
|
|
29
|
-
config.authentication_method = nil
|
|
30
|
-
end
|
data/lib/generators/active_agent/dashboard/templates/create_active_agent_telemetry_traces.rb.erb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class CreateActiveAgentTelemetryTraces < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
-
def change
|
|
5
|
-
create_table :active_agent_telemetry_traces do |t|
|
|
6
|
-
t.string :trace_id, null: false, index: true
|
|
7
|
-
t.string :service_name
|
|
8
|
-
t.string :environment
|
|
9
|
-
t.datetime :timestamp, index: true
|
|
10
|
-
t.jsonb :spans, default: []
|
|
11
|
-
t.jsonb :resource_attributes, default: {}
|
|
12
|
-
t.jsonb :sdk_info, default: {}
|
|
13
|
-
t.decimal :total_duration_ms, precision: 12, scale: 3
|
|
14
|
-
t.integer :total_input_tokens, default: 0
|
|
15
|
-
t.integer :total_output_tokens, default: 0
|
|
16
|
-
t.integer :total_thinking_tokens, default: 0
|
|
17
|
-
t.string :status
|
|
18
|
-
t.string :agent_class, index: true
|
|
19
|
-
t.string :agent_action
|
|
20
|
-
t.text :error_message
|
|
21
|
-
|
|
22
|
-
t.timestamps
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
add_index :active_agent_telemetry_traces, :status
|
|
26
|
-
add_index :active_agent_telemetry_traces, [:agent_class, :agent_action]
|
|
27
|
-
add_index :active_agent_telemetry_traces, [:service_name, :environment]
|
|
28
|
-
add_index :active_agent_telemetry_traces, :created_at
|
|
29
|
-
end
|
|
30
|
-
end
|