AIFeed

Show HN: Sample-incident-response-agent, open-source AI agent from AWS CIRT

Original text(via HN AI)

Incident Response Agent

题图
题图

An agentic AI assistant that triages suspected AWS security events. Given a reported event, the agent performs evidence-based triage: it works through a six-phase investigation workflow, maps findings to the Threat Technique Catalog for AWS (TTC) and MITRE ATT&CK, separates confirmed facts from inference, and produces a triage assessment for an analyst to review.

The agent is designed to be read-only and analyst-in-the-loop. Permissions are enforced by the AWS credentials you give it. It presents every assessment and stakeholder message as a draft for a human to review.

This is sample code, provided for learning and experimentation. Review it, and test it in your own environment, before using it in an investigation.

Why this agent

  • Evidence-based, not narrative-driven. It treats denied API calls and missing telemetry as evidence, builds an indicator matrix, and bounds the blast radius with explicit negative findings, rather than stopping at the first plausible story.
  • Read-only by design, enforced by IAM. Run the agent with a read-only IAM role or user (see docs/IAM-POLICY.md). AWS has implicit deny for actions, regardless of what any code does. On top of that, the live backend calls only read APIs, and the agent is limited on your machine: the Kiro Crew adapter denies file writes and shell commands, and in Codex you can enforce the same with a read-only sandbox.
  • Works with your agent host. The core is a stdio MCP tool server plus a methodology prompt and output schemas. Adapters for Kiro Crew and the OpenAI Codex CLI are included, and any MCP-capable host can use the tool server.
  • Offline or live. Investigate the bundled sample incident with no AWS account, or point the agent at a live AWS account. It uses the same tools and methodology either way.

How it works

Given a suspected security event, the agent works through six phases:

  • Environment Baseline
  • Indicator Analysis
  • Scope Determination
  • Triage Assessment
  • Documentation & Handoff

Run as a Kiro Crew bot (see below), it works Phases 1 through 5 on its own and pauses only for a decision or to approve the final write-up. Driven directly by an analyst instead, it pauses at each phase boundary for review. Either way it calls tools to gather and correlate evidence, reasons about behavioral anomalies, maps activity to threat techniques, and writes up a verdict with severity, root cause, visibility gaps, and prioritized remediation.

What's in the box

  • Investigation tools (tools/): an MCP server with eight read-only tools: evidence_search: search CloudTrail events evidence_aggregate: count CloudTrail events by principal, IP, event, region, or service query_state: list IAM users, access keys, and roles, EC2 instances, and S3 buckets list_findings: list Amazon GuardDuty findings dns_search: search Amazon Route 53 Resolver DNS query logs network_search: search Amazon VPC Flow Logs s3_access_search: search Amazon S3 server access logs catalog_lookup: map CloudTrail events to TTC and MITRE ATT&CK techniques The DNS, flow-log, and S3-access tools return data when the evidence bundle includes those sources. A backend that doesn't provide a source (the live AWS backend does not collect these today) reports it as a visibility gap rather than failing, so the agent treats a missing source as something to flag, not as proof the environment is clean. Evidence results include the AWS account ID the evidence comes from, so the agent can stop if it's connected to the wrong account.

Investigation tools (tools/): an MCP server with eight read-only tools:

  • evidence_search: search CloudTrail events
  • evidence_aggregate: count CloudTrail events by principal, IP, event, region, or service
  • query_state: list IAM users, access keys, and roles, EC2 instances, and S3 buckets
  • list_findings: list Amazon GuardDuty findings
  • dns_search: search Amazon Route 53 Resolver DNS query logs
  • network_search: search Amazon VPC Flow Logs
  • s3_access_search: search Amazon S3 server access logs
  • catalog_lookup: map CloudTrail events to TTC and MITRE ATT&CK techniques

The DNS, flow-log, and S3-access tools return data when the evidence bundle includes those sources. A backend that doesn't provide a source (the live AWS backend does not collect these today) reports it as a visibility gap rather than failing, so the agent treats a missing source as something to flag, not as proof the environment is clean.

Evidence results include the AWS account ID the evidence comes from, so the agent can stop if it's connected to the wrong account.

  • Workflow (workflow/): the six-phase methodology prompt, output schemas, and communication guidelines.
  • Technique catalog (catalog/): public (TLP:CLEAR) entries from the Threat Technique Catalog for AWS, plus a few MITRE ATT&CK techniques the TTC doesn't cover, with detection and mitigation guidance.
  • Sample evidence (evidence/sample-incident/): a scrubbed, multi-stage incident you can investigate offline. All account IDs, access keys, and IP addresses in it are placeholders or reserved documentation values.
  • Evaluation (evaluation/): an expert answer key and a scorer that grades an investigation report on four dimensions.
  • Host adapters (adapters/): setup for Kiro Crew (adapters/kiro-crew/) and the OpenAI Codex CLI (adapters/codex/). The Kiro Crew adapter also includes an optional autonomous bot (adapters/kiro-crew/bot/) that runs an investigation end to end and dispatches parallel read-only workers.
  • Launcher (bin/sec-tools-server.sh): starts the tool server reliably from any MCP host (see Connect to an MCP host).

Prerequisites

  • Git, to clone the repository.
  • Node.js 22 or later, which includes npm. Check your version with node --version. Node.js 20 and earlier are past end of support and no longer receive security updates.
  • An agent host to drive the investigation: Kiro Crew or the OpenAI Codex CLI. See the adapter guides below. Both hosts require you to sign in to them on first use (with your own account), and each has its own setup: Kiro Crew also needs Python 3 for the installer. On first launch the dashboard walks you through installing the Kiro CLI and completing sign-in; see the Kiro Crew installation guide. OpenAI Codex CLI needs its own sign-in to a Codex account; follow its install instructions.
  • Kiro Crew also needs Python 3 for the installer. On first launch the dashboard walks you through installing the Kiro CLI and completing sign-in; see the Kiro Crew installation guide.
  • OpenAI Codex CLI needs its own sign-in to a Codex account; follow its install instructions.

For live investigation of an AWS account, you also need:

  • An AWS account and credentials. We recommend least-privilege, read-only credentials (see docs/AUTHENTICATION.md).
  • The AWS Command Line Interface (AWS CLI), to set up a credentials profile and confirm which account it uses.

Quick start

Clone the repository, then install, build, and test:


        git clone https://github.com/aws-samples/sample-incident-response-agent.git
cd sample-incident-response-agent
npm install
npm run build
npm test
      

All tests should pass.

Try the bundled sample (no AWS account needed)

Start the tool server against the sample incident. It needs no credentials and no network access:


        SEC_BACKEND=local \
SEC_BUNDLE=./evidence/sample-incident \
  npm start
      

The server prints [tool-server] ready (backend=local, ...) and then waits for an MCP client to connect over stdio. Press Ctrl+C to stop it. To run an investigation, connect an agent host (see Run it in an agent host).

Investigate your own exported logs offline (no AWS access needed)

The offline backend reads any directory you point SEC_BUNDLE at, so you can investigate your own exported logs the same way — without giving the agent live AWS access. This suits teams that would rather analyze an export than connect a credential.

A bundle is a directory with these files (the bundled sample is a complete worked example of the format):

FileContentsRequired
cloudtrail-mgmt.jsonlCloudTrail management events, one event per lineYes
cloudtrail-data.jsonlCloudTrail data events, one event per lineOptional
findings.jsonArray of Amazon GuardDuty findingsOptional
account-state.jsonResource/identity snapshot, keyed by resource familyOptional
dns-queries.jsonlAmazon Route 53 Resolver query-log records, one per lineOptional
flow-logs.jsonlAmazon VPC Flow Log records, one per lineOptional
s3-access.jsonlAmazon S3 server access log records, one per lineOptional

The .jsonl files hold one raw JSON record per line — for CloudTrail, the same event shape delivered to Amazon S3. Only cloudtrail-mgmt.jsonl is required; any source you leave out is reported as a visibility gap during the investigation rather than causing an error, and malformed lines are skipped. Compare any file against evidence/sample-incident/ for the exact shape.

CloudTrail delivered to S3 arrives as gzipped JSON with the events under a Records array. To turn an export into cloudtrail-mgmt.jsonl (one event per line), for example with jq:


        # From a folder of CloudTrail .json.gz files exported from S3:
gunzip -c *.json.gz | jq -c '.Records[]' > /path/to/my-bundle/cloudtrail-mgmt.jsonl
      

Then point the server at your bundle and connect an agent host as usual:


        SEC_BACKEND=local \
SEC_BUNDLE=/path/to/my-bundle \
  npm start
      

Your logs stay on your machine: this backend makes no network calls and needs no credentials. Name the account your logs come from in your opening message, so the agent can confirm it is investigating the account you intend.

Investigate a live AWS account

First confirm which account your credentials profile uses:


        aws sts get-caller-identity --profile <your-profile>
      

Then start the tool server with that profile:


        export SEC_BACKEND=aws
export AWS_REGION=us-east-1
export AWS_PROFILE=<your-profile>
npm start
      

The agent can do whatever its credentials allow. We recommend least-privilege, read-only credentials; with a read-only IAM policy, AWS denies any write. The tool server reads credentials from the standard AWS credential chain. Credential values are never passed through the conversation or written into the agent configuration. See:

  • docs/AUTHENTICATION.md: ways to get credentials (assume a read-only role, AWS IAM Identity Center, or console sign-in), in order of preference.
  • docs/IAM-POLICY.md: the least-privilege read-only IAM policy, mapping each tool to the AWS API and IAM action it needs (iam-readonly-policy.json).

Run it in an agent host

The included adapters connect the tool server and the methodology prompt to your host:

  • Kiro Crew: adapters/kiro-crew/IMPORT.md. An installer adds the agent to the Crew agent picker (offline by default, or live, or both), and an autonomous bot is included.
  • OpenAI Codex CLI: adapters/codex/README.md. Add an MCP server block to ~/.codex/config.toml; Codex loads the methodology from AGENTS.md at the repository root.

Whichever you use, start a new session for each investigation so details from an earlier case don't carry into this one. In Kiro Crew, open a new conversation (a bot has a Fresh start control); for a single-agent chat, set memory mode to Temporary, which neither reads nor writes Crew memory (see Memory modes). In Codex, start a new codex session.

When you open an investigation, name the account in scope. Every evidence result reports the account ID it comes from. If your opening message puts a different account in scope, the agent stops at Phase 1 and asks you to reconnect or change the scope. The bundled sample uses account 111122223333; in live mode, it's the account aws sts get-caller-identity reports for your profile.

Run it autonomously as a Kiro Crew bot

The recommended way to run a full investigation in Kiro Crew is the bot: it works Phases 1 through 5 on its own, dispatches a separate read-only worker for each independent task (for example, one worker per identity, resource, or log source) and runs them in parallel, and pauses for you only to unblock a decision or to approve the final write-up in Phase 6. The bot never calls the investigation tools itself; its workers do, using the same methodology and the same read-only tools.

Run the bot on the Kiro agent harness. The investigator agent defines read-only permission rules (it denies file writes, shell, and reading sensitive paths). Kiro Crew only applies an agent's permission rules on a harness that supports them — the default Kiro agent backend. On another model backend, Crew won't apply those rules and will block the investigation tools, telling you to run the bot on the Kiro agent. So keep the bot's agent harness set to Kiro (Settings → Agent Harness). You can still use another harness, such as the OpenAI Codex CLI, through the single-agent flow below. (See the Kiro Crew docs on agent backends.)

The bot is defined in adapters/kiro-crew/bot/incident-response-agent.kirobot. Setting it up is an import plus a few one-time clicks in Crew, because importing a bot carries its name and rules but not its tool access or approval mode. In short:

  • Install the investigator agent first (adapters/kiro-crew/install.sh), so the bot has a worker agent to dispatch. See adapters/kiro-crew/IMPORT.md.
  • Import the bot in Crew: Bots → Import from file, choose adapters/kiro-crew/bot/incident-response-agent.kirobot, tick I understand this widens permissions, and select Import Bot.
  • Add the investigator ability to the bot (open it → Abilities → Add abilities, then select the agent), so its workers get the read-only sec-tools tools. The ability is added as soon as you select it; there is no separate save step.
  • Set the bot's approval mode to the most automatic one your build offers (for example Trust or Automatic). Every tool the bot can reach is read-only, so automatic approval is safe here, and it lets the parallel workers run without a prompt on each call. An interactive mode still works but asks before every tool call, which makes an autonomous multi-worker run slow.

adapters/kiro-crew/IMPORT.md gives the exact menu paths, the two-picker offline/live layout, the approval posture, and troubleshooting. To start an investigation, open the bot, click Fresh start to clear any previous conversation, and give it the account in scope, the incident time window, and the indicator you're investigating.

Run it as a single agent (one phase at a time)

If you'd rather drive the investigation yourself, or use the OpenAI Codex CLI, run it as a single agent instead of a bot. It works one phase per turn and pauses at each phase boundary for you to review before continuing — the same methodology and tools, without parallel workers. In Kiro Crew, pick the installed agent (incident-response-investigator, or incident-response-investigator-online for live) from the agent picker in a new Temporary session. In Codex, start a codex session after adding the MCP server block. Describe the suspected event — what was reported, the time window, and the account in scope — and reply to advance through the phases.

Connect to an MCP host

To use the tools from another MCP host, register the tool server as a stdio MCP server. Point the server's command at the launcher, bin/sec-tools-server.sh, rather than at node:

  • Many hosts start MCP servers with a reduced environment. Desktop apps on macOS get a minimal PATH that excludes Homebrew, nvm, and Volta, and some hosts omit HOME.
  • The launcher finds a supported node (22 or later), restores HOME and the AWS config file locations, and puts the AWS CLI on PATH for profiles that use credential_process. Then it starts the built server.
  • Run npm run build first; the launcher starts the built server.

A typical entry, in the JSON format most MCP hosts use (use absolute paths):


        {
  "mcpServers": {
    "sec-tools": {
      "command": "/absolute/path/to/repo/bin/sec-tools-server.sh",
      "args": [],
      "env": {
        "SEC_BACKEND": "local",
        "SEC_BUNDLE": "/absolute/path/to/repo/evidence/sample-incident"
      }
    }
  }
}
      

For live investigation, set env to SEC_BACKEND=aws, AWS_REGION, and optionally AWS_PROFILE. Never put credential values in the host configuration. If your host passes only selected environment variables to MCP servers, use a named profile or forward the AWS credential variables explicitly (see docs/AUTHENTICATION.md).

Score an investigation

Save the agent's final report as a Markdown file, then score it against the answer key for the sample incident:


        npm run evaluate -- evaluation/answer-keys/sample-incident.json <agent-report.md>
      

The scorer prints a score for each of four dimensions and an overall pass or fail. See evaluation/README.md for the rubric.

Project layout


        tools/          MCP tool server: read-only investigation tools and backends
bin/            sec-tools-server.sh: launcher to use as the MCP server command
workflow/       Six-phase methodology prompt, output schemas, communication guidelines
catalog/        Technique catalog (TLP:CLEAR) and its loader
evidence/       Bundled sample incident (scrubbed, offline)
evaluation/     Answer key and scorer
adapters/       Host adapters: Kiro Crew, OpenAI Codex CLI
AGENTS.md       Codex project instructions (generated from workflow/system-prompt.md)
docs/           Architecture, authentication, IAM policy
      

Documentation

  • docs/ARCHITECTURE.md: layers, data flow, safety model, and the limits of each evidence source
  • docs/AUTHENTICATION.md: credential options for live mode
  • docs/IAM-POLICY.md: least-privilege read-only IAM policy
  • workflow/README.md: the investigation workflow
  • catalog/README.md: the technique catalog and its sources
  • evaluation/README.md: the scoring rubric
  • evidence/sample-incident/README.md: the sample incident and its expected findings

Safety

  • IAM is the enforcement boundary. Run the agent with a least-privilege, read-only IAM role or user (docs/IAM-POLICY.md). AWS denies any action the policy doesn't explicitly allow, independent of the agent or its code. The agent does not inspect its own permissions or refuse to start, so it can do whatever the credentials you supply allow. We recommend read-only credentials.
  • Defense in depth. On top of IAM, the live backend calls only read APIs. On your machine, the Kiro Crew adapter denies file writes and shell commands. Codex can run shell commands by default; AGENTS.md instructs it not to change anything, and starting Codex with --sandbox read-only enforces that for shell commands (see adapters/codex/README.md). These controls reduce the chance of an unintended action, but they don't replace the IAM policy.
  • Drafts, not actions. The agent presents assessments and stakeholder messages as drafts for review. It recommends remediation; it has no tools to perform it.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Includes material from MITRE ATT&CK®. See catalog/README.md for attribution.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗