How bytemonk-academy/owasp-agentic-lab works
This repository is a hands-on agent-security lab: a deterministic or optional Anthropic planner proposes actions for a triage agent, while task-scoped controls determine which actions may run. The main workflow is task and context preparation, planning, goal-drift and policy checks, capability issuance, tool execution, and tagged results returned to context. The fake world makes reads, writes, execution, memory, and damage observable; the labs teach five external controls. Source excerpts show the main loop and tool wiring; unsampled model and world internals are represented only where the README or source index supports them.
Main entry points: agent.ts Agent loop · tools/index.ts Tool registry · state.ts World and damage ledger · model/index.ts Model loader
Components 20
Agent runtime
- Task definitions
src/agent/tasks.ts - Agent loop
src/agent/agent.ts - Model loader
src/model/index.ts - Scripted planner
src/model/scripted.ts - Anthropic planner
src/model/anthropic.ts - Agent contracts
src/types.ts
Security controls
- Provenance controls
src/security/untrusted.ts - Action policy
src/security/policy.ts - Task capabilities
src/security/capability.ts - Execution sandbox
src/security/sandbox.ts - Memory guard
src/security/memory-guard.ts
Agent tools
- Tool registry
src/tools/index.ts - Issue and docs tools
src/tools/index.ts - Config and customer tools
src/tools/index.ts - Write and shell tools
src/tools/index.ts
Simulated world
- Fake fixtures
src/world/fixtures.ts - World and damage ledger
src/world/state.ts - Attacker drop box
src/world/dropbox.ts - Attack harness
src/world/attacker-harness/scripts/repro.js
Other components
- Operator
Connections 23
- Operator → Task definitions: defines task
README.md - Task definitions → Agent loop: supplies task
- Agent loop → Model loader: loads planner
src/agent/agent.ts - Model loader → Scripted planner: selects default
src/model/index.ts - Model loader → Anthropic planner: selects optionally
src/model/index.ts - Agent loop → Provenance controls: prepares context
src/agent/agent.ts - Agent loop → Action policy: authorizes call
src/agent/agent.ts - Agent loop → Task capabilities: mints authority
src/agent/agent.ts - Agent loop → Memory guard: filters recall
src/agent/agent.ts - Agent loop → Tool registry: dispatches calls
src/agent/agent.ts - Tool registry → Task capabilities: asserts authority
src/tools/index.ts - Tool registry → Memory guard: checks persistence
src/tools/index.ts - Tool registry → Execution sandbox: executes command
src/tools/index.ts - Tool registry → Issue and docs tools: registers tools
src/tools/index.ts - Tool registry → Config and customer tools: registers tools
src/tools/index.ts - Tool registry → Write and shell tools: registers tools
src/tools/index.ts - Issue and docs tools → Fake fixtures: reads issue and docs
src/tools/index.ts - Config and customer tools → Fake fixtures: reads fake records
src/tools/index.ts - Issue and docs tools → World and damage ledger: looks up issue
src/tools/index.ts - Config and customer tools → World and damage ledger: records reads
src/tools/index.ts - Write and shell tools → World and damage ledger: records effects
src/tools/index.ts - World and damage ledger → Fake fixtures: initializes from
src/world/state.ts - Write and shell tools → Attack harness: may invoke