aws-bedrock-ops-agent
Incident triage copilot: evidence in, ranked hypotheses, checks, and escalation notes out.
A support-triage demo with synthetic incident and EDI fixtures. It returns ranked hypotheses, diagnostic checks, draft customer replies, and escalation notes. The public demo runs in mock mode; live mode connects to Amazon Bedrock. Note: CORS is pre-configured to accept requests from http://localhost:8080 and http://127.0.0.1:8080 (the debug console). For production, set CORS_ORIGINS to the deployed browser origin. /mcp has its own separate Host/Origin allowlist. See docs/MCP_SERVER.md. The live demo runs on Render's free tier with BEDROCK_MOCK=true. No AWS credentials needed.
Summary extracted from the README.
AWS Bedrock Agent
Live Demo Deploy FastAPI Python
A support-triage demo with synthetic incident and EDI fixtures. It returns ranked hypotheses, diagnostic checks, draft customer replies, and escalation notes. The public demo runs in mock mode; live mode connects to Amazon Bedrock.
Features
- Structured Triage:
POST /triageaccepts an incident evidence bundle; returns JSON with hypotheses, checks, and escalation readiness. - MCP Server: the same triage logic is exposed as an MCP tool at
/mcp, so any MCP-aware client (n8n, a custom agent, etc.) can call it directly. See MCP Server docs. - EDI Failure Triage:
POST /triage/ediand thetriage_edi_transactiontool run the same pattern on a failed EDI transaction, using the status model from Orderful's public docs. Built as an interview exercise; see EDI Triage docs for what is real and what is invented. - Mock Mode:
BEDROCK_MOCK=truereturns deterministic canned responses that work offline with no AWS credentials. - Live Bedrock Mode:
BEDROCK_MOCK=falsesends selected incident evidence to Amazon Bedrock and validates structured output. See evidence limits and filtering; EDI uses a separate input path.
Documentation
- Architecture - system boundaries, request flow, modes, and known limits
- MCP Server - the
/mcptool surface, transport, and how to connect a client - n8n Workflow - webhook → triage → Slack example; n8n execution unverified
- EDI Failure Triage - the same triage pattern pointed at EDI transaction failures, with fixtures and a CLI
- Operations Runbook - health checks, local/Render operations, failures, and rollback
- Security Notes - data handling, access controls, model output safety, and review checklist
- Portfolio Review Guide - suggested reviewer path, tradeoffs, and discussion topics
Quickstart
# Create an isolated environment (CI uses Python 3.11)
python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
# Start with mock mode (no AWS needed)
BEDROCK_MOCK=true python assistant.py
API
POST /triage
Request: incident evidence bundle
{
"incident_id": "INC-001",
"summary": "Auth cascade after token rotation",
"timeline": [
{ "ts": "2025-01-15T10:00:00Z", "event": "...", "trace_id": "tx-001" }
],
"log_lines": [
{ "level": "error", "message": "...", "trace_id": "tx-001" }
],
"request_samples": [
{ "method": "GET", "path": "/api/v1/data", "status": 403 }
],
"related_endpoints": ["/login", "/api/v1/data"]
}
Response: structured triage output
{
"incident_id": "INC-001",
"hypotheses": [
{
"rank": 1,
"hypothesis": "Token rotation invalidated active sessions without grace period",
"confidence": "high",
"evidence_ids": ["tx-001"],
"check_command": "curl -s -H 'Authorization: Bearer <old_token>' http://localhost:8000/api/v1/data"
}
],
"recommended_checks": [
"Verify token expiry on /login response",
"Check if /api/v1/data accepts the new token format"
],
"escalation_ready": true,
"customer_comms_draft": "We identified an authentication failure caused by a token rotation that invalidated active sessions. Engineering is reviewing the rollout sequence."
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
BEDROCK_MOCK |
true |
Use canned responses (no AWS) or call Bedrock |
LAB_BASE_URL |
http://failure-lab:8000 |
Used in /health response to indicate connected lab |
CORS_ORIGINS |
http://localhost:8080,http://127.0.0.1:8080 |
Comma-separated browser origins allowed to call the API |
AWS_REGION |
us-east-1 |
AWS region for Bedrock runtime calls |
BEDROCK_MODEL_ID |
amazon.titan-text-express-v1 |
Bedrock model invoked in live mode |
MCP_ALLOWED_HOSTS |
127.0.0.1:*,localhost:*,[::1]:* |
Comma-separated Host header allowlist for the /mcp endpoint |
MCP_ALLOWED_ORIGINS |
http://127.0.0.1:*,http://localhost:*,http://[::1]:* |
Comma-separated Origin header allowlist for the /mcp endpoint |
RATE_LIMIT_REQUESTS |
20 |
Max requests per client IP per window on /triage and /mcp. The Render deploy sets 200, since mock mode costs nothing per call |
RATE_LIMIT_WINDOW_SECONDS |
3600 |
Rate limit window, in seconds |
LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY |
unset | Enables OTel tracing of Bedrock calls to Langfuse when both are set; no-op otherwise |
LANGFUSE_HOST |
https://us.cloud.langfuse.com |
Langfuse region endpoint |
Note: CORS is pre-configured to accept requests from http://localhost:8080 and http://127.0.0.1:8080 (the debug console). For production, set CORS_ORIGINS to the deployed browser origin. /mcp has its own separate Host/Origin allowlist. See docs/MCP_SERVER.md.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /health |
Returns status, mode (mock/live), and lab_url |
| POST | /triage |
Accepts evidence bundle; returns hypotheses, checks, escalation notes |
| POST | /triage/edi |
Accepts a failed EDI transaction; returns tier, classification, hypotheses, customer reply, ticket-two action. See docs/EDI_TRIAGE.md |
| GET | /fixtures/edi |
Lists the sample EDI transactions the demo console shows, without their canned results |
| POST | /mcp/ |
MCP streamable-HTTP endpoint exposing the triage_incident tool. See docs/MCP_SERVER.md |
Deployment
Live Demo (Render)
curl https://aws-bedrock-ops-agent.onrender.com/health
curl -X POST https://aws-bedrock-ops-agent.onrender.com/triage \
-H "Content-Type: application/json" \
-d '{"incident_id":"INC-001","summary":"Auth cascade after token rotation","timeline":[],"log_lines":[],"request_samples":[],"related_endpoints":[]}'
The live demo runs on Render's free tier with BEDROCK_MOCK=true. No AWS credentials needed.
Local (Mock)
BEDROCK_MOCK=true python assistant.py
Development
python -m pip install -r requirements-dev.txt
ruff check .
pytest
pip-audit --strict --progress-spinner off
Security
Use least-privilege AWS credentials for live Bedrock mode. Keep the public demo in mock mode until authentication, request size limits, and data-handling controls are in place. See Security Notes; per-IP rate limiting is already enabled.
Related
- n8n-workflow-as-code: n8n workflows that call this repo's
/mcptool over live JSON-RPC - postman-tse-incident-lab: reproducible API incidents that produce the kind of evidence
/triageconsumes - incident-postmortems: where the escalation notes end up as written RCAs
License
MIT