# abhishekmodi11/agentwere_hackathon architecture

> Architecture diagram of the GitHub repository abhishekmodi11/agentwere_hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhishekmodi11/agentwere_hackathon
- Repository: https://github.com/abhishekmodi11/agentwere_hackathon

## Overview

First Responder is a sandboxed on-call agent that investigates a deployment alert, verifies a regression with independent evidence, authorizes a bounded rollback, and checks measured recovery. The principal flow runs from alert intake through orchestration and the policy gateway to sandbox tools, with operator approval or emergency stop where needed. JSONL audit events support live monitoring, replay, and postmortems; the dashboard also presents recovery proof and incident history. The README documents these links; sampled source additionally shows gateway authorization/execution and model evidence handling, but several core modules were not excerpted.

Main entry points: [`src/firstresponder/gateway.py`](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/gateway.py) (Policy gateway), [`src/firstresponder/orchestrator.py`](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/orchestrator.py) (Incident orchestrator), [`src/firstresponder/trace.py`](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/trace.py) (JSONL audit trace), [`src/firstresponder/approvals.py`](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/approvals.py) (Approval queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and control"]
  node_intake_api["Alert intake<br/>[intake.py]"]
  node_app["FastAPI service<br/>[main.py]"]
  node_stop["Emergency stop<br/>[killswitch.py]"]
end

subgraph group_investigation["Investigation"]
  node_orchestrator["Incident orchestrator<br/>[orchestrator.py]"]
  node_llm["Groq model client<br/>[groq_client.py]"]
  node_evidence["Evidence compaction<br/>[evidence.py]"]
  node_budget["Run budget<br/>[budget.py]"]
end

subgraph group_execution["Policy and execution"]
  node_gateway["Policy gateway<br/>[gateway.py]"]
  node_policy["Action policy<br/>[policy.py]"]
  node_schemas["Tool contracts<br/>[tool_args.py]"]
  node_sanitizer["Evidence sanitizer<br/>[sanitizer.py]"]
  node_tools["Sandbox tool registry<br/>[__init__.py]"]
  node_rollback["Rollback tool<br/>[rollback.py]"]
  node_approvals[("Approval queue<br/>[approvals.py]")]
end

subgraph group_audit["Audit and reporting"]
  node_trace[("JSONL audit trace<br/>[trace.py]")]
  node_reporter["Postmortem and notification<br/>[reporter.py]"]
  node_monitor["Live event monitor<br/>[monitor.py]"]
end

subgraph group_operator["Operator experience"]
  node_dashboard["Incident dashboard<br/>[main.tsx]"]
  node_incident_view["Incident replay model<br/>[incident.ts]"]
  node_terminal["Terminal trace monitor<br/>[watch.py]"]
end

node_alerter["Sandbox alerter<br/>[alerter.py]"]
node_sandbox["Demo service<br/>[app.py]"]
node_operator(("Operator"))
node_groq["Groq API"]

node_alerter -->|"sends alert"| node_intake_api
node_intake_api -->|"starts investigation"| node_orchestrator
node_app -->|"routes intake"| node_intake_api
node_orchestrator -->|"requests proposals"| node_llm
node_llm -->|"calls model"| node_groq
node_orchestrator -->|"compacts evidence"| node_evidence
node_llm -->|"accounts usage"| node_budget
node_orchestrator -->|"requests tools"| node_gateway
node_gateway -->|"evaluates action"| node_policy
node_gateway -->|"validates arguments"| node_schemas
node_gateway -->|"sanitizes results"| node_sanitizer
node_gateway -->|"dispatches tools"| node_tools
node_tools -->|"reads evidence"| node_sandbox
node_gateway -->|"requests decision"| node_approvals
node_operator -->|"approves action"| node_approvals
node_approvals -->|"returns decision"| node_gateway
node_gateway -->|"dispatches rollback"| node_rollback
node_rollback -->|"executes rollback"| node_sandbox
node_orchestrator -->|"checks recovery"| node_sandbox
node_orchestrator -->|"records decisions"| node_trace
node_gateway -->|"records actions"| node_trace
node_approvals -->|"records decisions"| node_trace
node_app -->|"handles stop"| node_stop
node_operator -->|"requests stop"| node_stop
node_app -->|"streams events"| node_monitor
node_trace -->|"supplies events"| node_monitor
node_monitor -->|"streams to browser"| node_dashboard
node_trace -->|"replays trace"| node_terminal
node_dashboard -->|"summarizes incidents"| node_incident_view
node_trace -->|"feeds postmortem"| node_reporter
node_reporter -->|"presents report"| node_operator

click node_alerter "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/sandbox/alerter/alerter.py"
click node_intake_api "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/intake.py"
click node_app "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/main.py"
click node_stop "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/killswitch.py"
click node_orchestrator "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/orchestrator.py"
click node_llm "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/llm/groq_client.py"
click node_evidence "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/llm/evidence.py"
click node_budget "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/budget.py"
click node_gateway "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/gateway.py"
click node_policy "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/policy.py"
click node_schemas "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/schemas/tool_args.py"
click node_sanitizer "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/sanitizer.py"
click node_tools "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/tools/__init__.py"
click node_rollback "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/tools/rollback.py"
click node_sandbox "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/sandbox/demo-service/app.py"
click node_approvals "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/approvals.py"
click node_trace "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/trace.py"
click node_reporter "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/reporter.py"
click node_monitor "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/monitor.py"
click node_dashboard "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/ui/src/main.tsx"
click node_incident_view "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/ui/src/incident.ts"
click node_terminal "https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/scripts/watch.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_intake_api,node_app,node_stop toneBlue
class node_orchestrator,node_llm,node_evidence,node_budget toneAmber
class node_gateway,node_policy,node_schemas,node_sanitizer,node_tools,node_rollback,node_approvals,node_groq toneMint
class node_trace,node_reporter,node_monitor toneRose
class node_dashboard,node_incident_view,node_terminal,node_operator toneIndigo
class node_alerter,node_sandbox toneTeal
```

## Components

### Intake and control

- [Alert intake](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/intake.py): `src/firstresponder/intake.py`
- [FastAPI service](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/main.py): `src/firstresponder/main.py`
- [Emergency stop](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/killswitch.py): `src/firstresponder/killswitch.py`

### Investigation

- [Incident orchestrator](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/orchestrator.py): `src/firstresponder/orchestrator.py`
- [Groq model client](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/llm/groq_client.py): `src/firstresponder/llm/groq_client.py`
- [Evidence compaction](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/llm/evidence.py): `src/firstresponder/llm/evidence.py`
- [Run budget](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/budget.py): `src/firstresponder/budget.py`

### Policy and execution

- [Policy gateway](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/gateway.py): `src/firstresponder/gateway.py`
- [Action policy](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/policy.py): `src/firstresponder/policy.py`
- [Tool contracts](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/schemas/tool_args.py): `src/firstresponder/schemas/tool_args.py`
- [Evidence sanitizer](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/sanitizer.py): `src/firstresponder/sanitizer.py`
- [Sandbox tool registry](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/tools/__init__.py): `src/firstresponder/tools/__init__.py`
- [Rollback tool](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/tools/rollback.py): `src/firstresponder/tools/rollback.py`
- [Approval queue](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/approvals.py): `src/firstresponder/approvals.py`

### Audit and reporting

- [JSONL audit trace](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/trace.py): `src/firstresponder/trace.py`
- [Postmortem and notification](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/reporter.py): `src/firstresponder/reporter.py`
- [Live event monitor](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/src/firstresponder/monitor.py): `src/firstresponder/monitor.py`

### Operator experience

- [Incident dashboard](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/ui/src/main.tsx): `ui/src/main.tsx`
- [Incident replay model](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/ui/src/incident.ts): `ui/src/incident.ts`
- [Terminal trace monitor](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/scripts/watch.py): `scripts/watch.py`

### Other components

- [Sandbox alerter](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/sandbox/alerter/alerter.py): `sandbox/alerter/alerter.py`
- [Demo service](https://github.com/abhishekmodi11/agentwere_hackathon/blob/main/sandbox/demo-service/app.py): `sandbox/demo-service/app.py`
- **Operator**
- **Groq API**

## Connections

- Sandbox alerter → Alert intake: sends alert (evidence: `README.md`)
- Alert intake → Incident orchestrator: starts investigation (evidence: `README.md`)
- FastAPI service → Alert intake: routes intake (evidence: `README.md`)
- Incident orchestrator → Groq model client: requests proposals (evidence: `README.md`)
- Groq model client → Groq API: calls model (evidence: `README.md`)
- Incident orchestrator → Evidence compaction: compacts evidence (evidence: `src/firstresponder/orchestrator.py`)
- Groq model client → Run budget: accounts usage (evidence: `src/firstresponder/llm/groq_client.py`)
- Incident orchestrator → Policy gateway: requests tools (evidence: `README.md`)
- Policy gateway → Action policy: evaluates action (evidence: `src/firstresponder/gateway.py`)
- Policy gateway → Tool contracts: validates arguments (evidence: `src/firstresponder/gateway.py`)
- Policy gateway → Evidence sanitizer: sanitizes results (evidence: `src/firstresponder/gateway.py`)
- Policy gateway → Sandbox tool registry: dispatches tools (evidence: `src/firstresponder/gateway.py`)
- Sandbox tool registry → Demo service: reads evidence (evidence: `README.md`)
- Policy gateway → Approval queue: requests decision (evidence: `README.md`)
- Operator → Approval queue: approves action (evidence: `README.md`)
- Approval queue → Policy gateway: returns decision (evidence: `README.md`)
- Policy gateway → Rollback tool: dispatches rollback (evidence: `README.md`)
- Rollback tool → Demo service: executes rollback (evidence: `src/firstresponder/tools/rollback.py`)
- Incident orchestrator → Demo service: checks recovery (evidence: `README.md`)
- Incident orchestrator → JSONL audit trace: records decisions (evidence: `README.md`)
- Policy gateway → JSONL audit trace: records actions (evidence: `README.md`)
- Approval queue → JSONL audit trace: records decisions (evidence: `README.md`)
- FastAPI service → Emergency stop: handles stop (evidence: `src/firstresponder/main.py`)
- Operator → Emergency stop: requests stop (evidence: `README.md`)
- FastAPI service → Live event monitor: streams events (evidence: `src/firstresponder/main.py`)
- JSONL audit trace → Live event monitor: supplies events (evidence: `README.md`)
- Live event monitor → Incident dashboard: streams to browser (evidence: `README.md`)
- JSONL audit trace → Terminal trace monitor: replays trace (evidence: `README.md`)
- Incident dashboard → Incident replay model: summarizes incidents (evidence: `ui/src/main.tsx`)
- JSONL audit trace → Postmortem and notification: feeds postmortem (evidence: `README.md`)
- Postmortem and notification → Operator: presents report (evidence: `README.md`)
