Agent System
Agent System
Autonomous agent events, actions, metrics, cost tracking, and infrastructure management.
12 tables in this group.
agent_events
Inter-agent communication bus backed by Supabase Realtime
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
source_agent_id | text | No | |
source_agent_type | text | No | |
event_type | text | No | |
payload | jsonb | No | '{}'::jsonb |
target_agent_ids | _text | Yes | '{}'::text[] |
correlation_id | uuid | Yes | |
created_at | timestamptz | No | now() |
RLS Policies:
All authenticated users can read agent events— SELECT for {public}Service role full access to agent events— ALL for {public}
Indexes:
agent_events_pkeyidx_agent_events_correlationidx_agent_events_createdidx_agent_events_created_atidx_agent_events_event_typeidx_agent_events_sourceidx_agent_events_source_agentidx_agent_events_targetsidx_agent_events_type
agent_actions
Complete audit trail of all actions taken by agents in the swarm
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
agent_name | text | No | |
agent_version | text | Yes | '1.0.0'::text |
action_type | text | No | |
action_category | text | Yes | |
incident_id | uuid | Yes | |
helpdesk_ticket_id | uuid | Yes | |
coding_request_id | uuid | Yes | |
input_context | jsonb | No | '{}'::jsonb |
output_result | jsonb | No | '{}'::jsonb |
success | bool | No | |
error_message | text | Yes | |
execution_time_ms | int4 | Yes | |
workflow_run_id | text | Yes | |
workflow_job_id | text | Yes | |
requires_approval | bool | Yes | false |
approval_status | text | Yes | |
approved_by | text | Yes | |
approved_at | timestamptz | Yes | |
created_at | timestamptz | No | now() |
RLS Policies:
Service role full access on agent_actions— ALL for {service_role}
Indexes:
agent_actions_agent_idxagent_actions_incident_idxagent_actions_pkey
agent_metrics
Performance metrics aggregated by hour for the swarm
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
bucket_start | timestamptz | No | |
bucket_end | timestamptz | No | |
agent_name | text | No | |
actions_total | int4 | No | 0 |
actions_successful | int4 | No | 0 |
actions_failed | int4 | No | 0 |
avg_execution_time_ms | int4 | Yes | |
p50_execution_time_ms | int4 | Yes | |
p95_execution_time_ms | int4 | Yes | |
p99_execution_time_ms | int4 | Yes | |
incidents_detected | int4 | Yes | 0 |
incidents_auto_resolved | int4 | Yes | 0 |
incidents_escalated | int4 | Yes | 0 |
mttr_ms | int4 | Yes | |
created_at | timestamptz | No | now() |
RLS Policies:
Service role full access on agent_metrics— ALL for {service_role}
Indexes:
agent_metrics_bucket_start_agent_name_keyagent_metrics_pkeyagent_metrics_time_idx
agent_costs
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
agent_id | text | No | |
cost_type | text | No | |
amount_usd | numeric | No | |
description | text | Yes | |
metadata | jsonb | Yes | '{}'::jsonb |
created_at | timestamptz | Yes | now() |
RLS Policies:
authenticated_read— SELECT for {public}service_role_all— ALL for {public}
Indexes:
agent_costs_pkeyidx_agent_costs_agentidx_agent_costs_type
agent_swarm_config
Runtime configuration for agent behavior
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
config_key | text | No | |
config_value | jsonb | No | |
description | text | Yes | |
value_schema | jsonb | Yes | |
updated_by | text | Yes | |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
RLS Policies:
Service role full access on agent_swarm_config— ALL for {service_role}
Indexes:
agent_swarm_config_config_key_keyagent_swarm_config_pkey
infrastructure_incidents
Tracks all infrastructure incidents detected and handled by the agent swarm
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
incident_number | int4 | No | nextval('infrastructure_incidents_incident_number_seq'::r... |
severity | text | No | |
status | text | No | 'detected'::text |
incident_type | text | No | |
source | text | No | |
source_id | text | Yes | |
affected_services | _text | No | '{}'::text[] |
title | text | No | |
error_message | text | Yes | |
error_details | jsonb | Yes | '{}'::jsonb |
sentry_issue_id | text | Yes | |
linear_issue_id | text | Yes | |
slack_channel_id | text | Yes | |
slack_thread_ts | text | Yes | |
github_workflow_run_id | text | Yes | |
embedding | vector | Yes | |
resolution_steps | jsonb | Yes | '[]'::jsonb |
resolution_summary | text | Yes | |
resolved_by | text | Yes | |
resolved_at | timestamptz | Yes | |
time_to_detect_ms | int4 | Yes | |
time_to_mitigate_ms | int4 | Yes | |
time_to_resolve_ms | int4 | Yes | |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
RLS Policies:
Service role full access on infrastructure_incidents— ALL for {service_role}
Indexes:
infrastructure_incidents_embedding_idxinfrastructure_incidents_incident_number_keyinfrastructure_incidents_pkeyinfrastructure_incidents_services_idxinfrastructure_incidents_status_idx
runbook_patterns
Learned patterns from resolved incidents for future automation
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
pattern_name | text | No | |
pattern_type | text | No | |
trigger_conditions | jsonb | No | '{}'::jsonb |
automated_steps | jsonb | No | '[]'::jsonb |
requires_approval | bool | No | false |
auto_execute_threshold | int4 | Yes | 3 |
usage_count | int4 | No | 0 |
success_count | int4 | No | 0 |
failure_count | int4 | No | 0 |
avg_resolution_time_ms | int4 | Yes | |
description | text | Yes | |
embedding | vector | Yes | |
version | int4 | No | 1 |
previous_version_id | uuid | Yes | |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
last_used_at | timestamptz | Yes |
RLS Policies:
Service role full access on runbook_patterns— ALL for {service_role}
Indexes:
runbook_patterns_embedding_idxrunbook_patterns_pattern_name_keyrunbook_patterns_pkeyrunbook_patterns_type_idx
sentry_error_mappings
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
sentry_issue_id | text | No | |
linear_issue_id | text | No | |
error_type | text | No | |
team_key | text | No | |
status | text | No | 'open'::text |
event_count | int4 | No | 1 |
first_seen_at | timestamptz | No | now() |
last_seen_at | timestamptz | No | now() |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
RLS Policies:
authenticated_read_sentry_mappings— SELECT for {authenticated}service_role_full_access_sentry_mappings— ALL for {service_role}
Indexes:
idx_sentry_mappings_error_typeidx_sentry_mappings_linear_issueidx_sentry_mappings_statusidx_sentry_mappings_teamsentry_error_mappings_pkeysentry_error_mappings_sentry_issue_id_key
fix_metrics
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
error_type | text | No | |
linear_issue_id | text | Yes | |
sentry_issue_id | text | Yes | |
github_pr_url | text | Yes | |
source | text | No | 'unknown'::text |
team_key | text | Yes | |
severity | text | Yes | |
detected_at | timestamptz | No | now() |
acknowledged_at | timestamptz | Yes | |
fix_started_at | timestamptz | Yes | |
fix_completed_at | timestamptz | Yes | |
time_to_acknowledge | interval | Yes | |
time_to_fix_start | interval | Yes | |
time_to_resolution | interval | Yes | |
fix_successful | bool | Yes | |
fix_method | text | Yes | |
regression_occurred | bool | Yes | false |
commit_sha | text | Yes | |
notes | text | Yes | |
metadata | jsonb | Yes | '{}'::jsonb |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
RLS Policies:
authenticated_read_fix_metrics— SELECT for {authenticated}service_role_full_access_fix_metrics— ALL for {service_role}
Indexes:
fix_metrics_pkeyidx_fix_metrics_detectedidx_fix_metrics_error_typeidx_fix_metrics_sourceidx_fix_metrics_successfulidx_fix_metrics_team
automation_analytics
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
period_start | timestamptz | No | |
period_days | int4 | No | 7 |
prs_total | int4 | No | 0 |
prs_merged | int4 | No | 0 |
claude_reviews | int4 | No | 0 |
claude_issues_found | int4 | No | 0 |
claude_critical_issues | int4 | No | 0 |
ci_runs | int4 | No | 0 |
ci_failures | int4 | No | 0 |
linear_issues | int4 | No | 0 |
linear_completed | int4 | No | 0 |
linear_ci_failure_issues | int4 | No | 0 |
linear_sentry_issues | int4 | No | 0 |
pr_merge_rate | numeric | Yes | |
ci_success_rate | numeric | Yes | |
review_coverage | numeric | Yes | |
created_at | timestamptz | No | now() |
RLS Policies:
authenticated_read_analytics— SELECT for {authenticated}service_role_full_access_analytics— ALL for {service_role}
Indexes:
automation_analytics_pkeyidx_automation_analytics_periodidx_automation_analytics_unique_period
coding_requests
Feature requests and bug fixes from Slack/Linear handled by the coding agent
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
request_number | int4 | No | nextval('coding_requests_request_number_seq'::regclass) |
source | text | No | |
source_id | text | No | |
source_url | text | Yes | |
title | text | No | |
description | text | Yes | |
request_type | text | No | 'feature'::text |
priority | text | No | 'medium'::text |
estimated_complexity | text | Yes | |
status | text | No | 'pending'::text |
implementation_plan | jsonb | Yes | '{}'::jsonb |
files_to_create | _text | Yes | '{}'::text[] |
files_to_modify | _text | Yes | '{}'::text[] |
test_files | _text | Yes | '{}'::text[] |
branch_name | text | Yes | |
pr_number | int4 | Yes | |
pr_url | text | Yes | |
pr_status | text | Yes | |
assigned_agent | text | Yes | 'coding-agent'::text |
requested_by_id | text | Yes | |
requested_by_name | text | Yes | |
requested_by_email | text | Yes | |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
started_at | timestamptz | Yes | |
completed_at | timestamptz | Yes |
RLS Policies:
Service role full access on coding_requests— ALL for {service_role}
Indexes:
coding_requests_pkeycoding_requests_request_number_keycoding_requests_source_idxcoding_requests_status_idx
approval_requests
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
agent_name | varchar(100) | No | |
action_type | varchar(100) | No | |
action_details | jsonb | No | |
risk_level | varchar(20) | No | 'medium'::character varying |
status | varchar(50) | No | 'pending'::character varying |
slack_channel_id | varchar(50) | Yes | |
slack_message_ts | varchar(50) | Yes | |
slack_thread_ts | varchar(50) | Yes | |
resolved_by | varchar(255) | Yes | |
resolved_at | timestamptz | Yes | |
rejection_reason | text | Yes | |
continuation_event_type | varchar(100) | Yes | |
continuation_payload | jsonb | Yes | |
expires_at | timestamptz | No | (now() + '24:00:00'::interval) |
created_at | timestamptz | No | now() |
updated_at | timestamptz | No | now() |
RLS Policies:
Service role full access on approval_requests— ALL for {public}
Indexes:
approval_requests_pkeyidx_approval_requests_slackidx_approval_requests_status