Skip to main content
Glama
SahanaReddy5

agentops-incident-commander

by SahanaReddy5
README.md
# AgentOps Incident Commander

A production-oriented incident-response agent built in TypeScript. It gathers operational evidence, proposes a remediation, pauses for human approval, executes the action in a simulator, verifies recovery, and stores an auditable trace that can be replayed without invoking a model.

## What this demonstrates

- Controlled agent workflows with read and write boundaries
- Human approval before risky tool execution
- MCP-compatible operational tools
- Deterministic offline operation and optional Ollama planning
- Trace persistence and model-free replay
- OpenTelemetry instrumentation around investigations and decisions
- Agent evaluation based on outcomes rather than prose alone
- Failure-safe incident simulation

## Quick start

Requirements: Node.js 22 or newer.

```bash
npm install
npm start
```

Open <http://localhost:3000>.

The default planner is deterministic and requires no API key or model download.

## Run tests and evaluations

```bash
npm test
npm run typecheck
npm run eval
```

## Use a local Ollama model

Install Ollama, pull any tool-capable local model you prefer, and set:

```bash
AGENT_MODEL=ollama
OLLAMA_MODEL=qwen3:4b
npm start
```

On Windows PowerShell:

```powershell
$env:AGENT_MODEL = "ollama"
$env:OLLAMA_MODEL = "qwen3:4b"
npm start
```

## Run the MCP server

The repository includes a stdio MCP server exposing safe read tools:

```bash
npm run mcp
```

Set `INCIDENT_ID` to choose a scenario. Write operations remain controlled by the application approval policy.

## API

- `GET /api/incidents` — list safe incident summaries
- `POST /api/incidents/:id/investigate` — collect evidence and create an approval request
- `POST /api/runs/:id/decision` — approve or reject remediation
- `GET /api/runs/:id/replay` — replay recorded tool events without a model
- `GET /api/runs` — list stored runs

## Safety model

Read tools execute automatically. A write operation is possible only after an explicit approval decision. The simulator rejects an action that does not match the scenario's permitted recovery action. Rejected approvals produce no write event.

## Roadmap

- PostgreSQL checkpointer for restart-safe pending approvals
- OpenTelemetry trace export and trace visualization
- Adversarial incident and prompt-injection datasets
- Authentication and role-based approval policies
- A2A adapter for external specialist agents
- Dockerized local-model profile with automated model setup

## Architecture

```mermaid
flowchart TD
  A[Incident alert] --> B[Evidence collection]
  B --> C[Diagnosis planner]
  C --> D{Human approval}
  D -->|Approve| E[Sandboxed remediation]
  D -->|Reject| F[Safe stop]
  E --> G[Health verification]
  G --> H[Trace store and replay]
```

## License

MIT