activeagent 1.0.3 → 1.1.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +26 -0
  4. data/lib/active_agent/base.rb +4 -0
  5. data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/api/traces_controller.rb +27 -6
  6. data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/application_controller.rb +11 -1
  7. data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/dashboard_controller.rb +15 -12
  8. data/lib/active_agent/dashboard/app/controllers/active_agent/dashboard/traces_controller.rb +27 -7
  9. data/lib/active_agent/dashboard/app/jobs/active_agent/process_telemetry_traces_job.rb +9 -0
  10. data/lib/active_agent/dashboard/app/models/active_agent/telemetry_trace.rb +18 -2
  11. data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/_trace_detail.html.erb +15 -3
  12. data/lib/active_agent/dashboard/app/views/active_agent/dashboard/traces/metrics.html.erb +3 -1
  13. data/lib/active_agent/dashboard/app/views/layouts/active_agent/dashboard/application.html.erb +4 -4
  14. data/lib/active_agent/dashboard/config/routes.rb +5 -64
  15. data/lib/active_agent/dashboard/engine.rb +19 -15
  16. data/lib/active_agent/dashboard.rb +13 -3
  17. data/lib/active_agent/model_capabilities.rb +89 -0
  18. data/lib/active_agent/providers/_base_provider.rb +23 -2
  19. data/lib/active_agent/providers/concerns/exception_handler.rb +12 -1
  20. data/lib/active_agent/providers/errors.rb +140 -0
  21. data/lib/active_agent/providers/ollama/chat/transforms.rb +9 -3
  22. data/lib/active_agent/railtie.rb +5 -0
  23. data/lib/active_agent/telemetry/configuration.rb +112 -172
  24. data/lib/active_agent/telemetry/instrumentation.rb +137 -14
  25. data/lib/active_agent/telemetry/reporter.rb +12 -165
  26. data/lib/active_agent/telemetry/span.rb +18 -245
  27. data/lib/active_agent/telemetry/tracer.rb +67 -70
  28. data/lib/active_agent/telemetry.rb +1 -2
  29. data/lib/active_agent/version.rb +1 -1
  30. data/lib/active_agent.rb +5 -0
  31. data/lib/generators/active_agent/dashboard/install_generator.rb +30 -2
  32. data/lib/generators/active_agent/dashboard/templates/active_agent_dashboard.rb.erb +41 -4
  33. data/lib/generators/active_agent/dashboard/templates/create_active_agent_telemetry_traces.rb.erb +20 -4
  34. metadata +17 -11
  35. data/lib/generators/active_agent/dashboard/install/install_generator.rb +0 -96
  36. data/lib/generators/active_agent/dashboard/install/templates/initializer.rb +0 -89
  37. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_runs.rb +0 -42
  38. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_templates.rb +0 -38
  39. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agent_versions.rb +0 -22
  40. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_agents.rb +0 -53
  41. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_sandbox_runs.rb +0 -28
  42. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_sandbox_sessions.rb +0 -43
  43. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_session_recordings.rb +0 -44
  44. data/lib/generators/active_agent/dashboard/install/templates/migrations/create_active_agent_telemetry_traces.rb +0 -56
@@ -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