SECURITY / AI AGENTS
Chain of Custody
An AI evidence-audit agent that can investigate a fictional case but cannot change its record, running on Amazon Bedrock AgentCore behind layered, independently enforced controls.

The problem
An AI agent with tools can be talked into doing things it should not, and instructions in a prompt are not a security control. Chain of Custody asks a narrower question: can an agent do useful audit work on evidence while being structurally unable to rewrite that evidence or its history?
The case, “The Blackwater Evidence”, is entirely fictional: synthetic people, places and records. I built it for the AWS Builder Center hackathon “Agents, your rules” (November 2026). It is a personal project, not employer work, and its documentation states that it was built with substantial help from Claude Code under my direction.
Architecture
- Agent: Claude Sonnet 4.6 runs on the Amazon Bedrock AgentCore managed harness and can only use five scoped evidence tools.
- Gateway and Cedar: an AgentCore Gateway admits only the agent’s role, and Cedar policies deny anything not explicitly permitted.
- Domain core: re-checks every call against a deny-by-default role matrix, whatever the earlier layers decided.
- Record: evidence is create-only, and the custody ledger is hash-chained and append-only, stored in DynamoDB with an S3 Object Lock archive.
- People decide: only a person promotes a draft, approves, or exports. Approvals are bound to the exact payload, single-use, and must come from a different supervisor.
Decisions and tradeoffs
- Independent layers. A request stops at the first control that denies it, so one bypassed layer does not expose the record.
- No update or delete operations exist. Corrections append a new entry that references the exact target hash.
- Fail closed. If the audit log is unavailable, protected operations refuse before running, and a storage timeout is reported as an unknown outcome, never as “nothing happened”.
- Cost and blast radius: the AWS run had a $25 budget and same-day teardown.
Security testing
On November 19, 2026, the agent ran live on AWS. An unsigned request to the Gateway got 401, and a call signed with an administrator role was denied by policy. The agent did its real job: it compared evidence versions and recorded a finding that cites them.
Two identical stress runs of nine prompts (eight adversarial, including direct and indirect prompt injection, requests to overwrite evidence, and attempts to reach credentials) left the evidence and ledger unchanged both times.
What this does not show: in five of the eight attacks the model refused before calling any tool, so those prompts never reached the backend. The backend’s own refusals for those cases are covered by deterministic tests. Two things broke during the live run, an IAM trust policy and a tool schema mismatch, and both are documented with their fixes.
Testing and validation
The domain core, policies, local application, AWS adapters and infrastructure templates are covered by Node test-runner suites, plus Playwright browser tests for the local investigation workspace. An “Integrity Challenge” in the local demo runs 28 attempts (21 attacks, 7 legitimate) and shows which layer refused each attack.
Outcome and limits
The agent ran on a real AgentCore deployment and held its rules under adversarial prompts, with evidence in CloudTrail and recorded reports. Nothing is deployed now. Model behavior is probabilistic, so the design relies on the deterministic layers rather than on the model refusing.
