Skip to main content

SDAC Agents

Overview

SDAC agents are specialized copilots tailored to review, widget, evaluation, and feedback-automation tasks. Prompts are stored in Core.AgentProfiles and loaded dynamically at runtime. buildSdacAgents() currently registers 11 profile-backed agents with versioned prompt overrides.

Agent Catalog

Validation Agents (one page per agent)

AI Widget Agent

  • Coordinator Release -- Primary agent powering the SDAC AI Widget (POST /sdac/chat behind the widget proxy)

Optimization Agent

Feedback Planning And Evaluation Agents

  • Feedback Planner (sdac-feedback-planner, registry sdac_feedback-planner-agent) -- Groups append-only feedback into actionable evidence packages and issue drafts for the scheduled Linear automation. It does not mutate prompts.
  • Widget Conversation Evaluator (sdac-widget-conversation-evaluator, registry sdac_widget-conversation-evaluator-agent) -- Scores recorded widget scenarios and request traces for deterministic test/evaluation runs. It has no production chat tools.

Source: packages/domain-sdac/src/agents.ts.

AI Widget Integration

The SDAC AI Widget supports dynamic agent routing via the agentId field in the chat request. The chat endpoint uses an AGENT_BUILDERS registry to dispatch requests to the correct agent builder. If agentId is omitted, the server falls back to the SDAC_DEFAULT_AGENT_ID environment variable, then to sdac-coordinator-release.

Currently registered agents:

  • Coordinator Release (sdac-coordinator-release) -- Primary widget agent for cost report Q&A
  • Review Coordinator (sdac-review-coordinator) -- Orchestrates comprehensive multi-category review

All widget agents share these capabilities:

  • SSE streaming -- Real-time response streaming via direct runtime POST /sdac/chat or widget proxy POST /api/ingestion/sdac/chat
  • Context-aware validation -- Uses sdac-get-report-info, sdac-validate-fringe, sdac-compare-quarters, and sdac-cross-reference-replacements
  • Session management -- Server-side conversation persistence with 90-day retention
  • Token tracking -- Logs model usage (prompt/completion tokens) per turn

API Endpoint:

POST /sdac/chat
Content-Type: application/json

{
"reportId": "8201EDC2-2EDE-4CA1-AF44-D0F5AA185CDB",
"message": "What is the fringe variance?",
"userId": "auditor@state.gov",
"sessionId": "browser-session-123",
"conversationId": null,
"agentId": "sdac-coordinator-release"
}
FieldDescription
agentIdOptional. Agent to handle the request. Defaults to SDAC_DEFAULT_AGENT_ID env var, then sdac-coordinator-release. Returns 400 for unknown agent IDs.

Response: Server-Sent Events with metadata, delta, usage, and done events. See Streaming Responses for details.

Feedback Loop

The Prompt Tuner Agent works within the Prompt Tuning Workflow to propose or apply agent prompt changes:

  1. User feedback captured via direct runtime POST /sdac/feedback or widget proxy POST /api/ingestion/sdac/feedback
  2. Feedback aggregated and analyzed by the Prompt Tuner Agent
  3. Revised prompts applied with 5 safety gates (minimum confidence, content validation, idempotency)
  4. All runs logged to SDAC.log_PromptTuningRuns for audit
  5. SCD Type 2 versioning in Core.AgentProfiles provides rollback safety

Separately, sdac-feedback-linear-automation uses the Feedback Planner to group unprocessed feedback and create Linear issues when the integration is enabled. It writes an audit run and only then marks consumed feedback rows.

Agent Communication Style

All SDAC agents follow structured reporting patterns:

  1. Overview -- "I found 3 errors in the source codes"
  2. Detailed list -- Each error with row number, specific issue, and context
  3. Offer help -- "Would you like me to explain any of these errors?"
  4. Corrections -- Step-by-step fix instructions with guideline references

Next Steps