Prerequisites
Before adding a new agent, you should understand:- Shannon’s agent registry system (
src/session-manager.ts) - Temporal workflow phases (
src/temporal/workflows.ts) - Prompt template structure (
prompts/directory) - Agent execution lifecycle (
src/services/agent-execution.ts)
Agent Types
Shannon has two main agent categories:Vulnerability Analysis Agents
Analyze source code and live application to identify potential vulnerabilities
Exploitation Agents
Attempt to exploit identified vulnerabilities to prove they are exploitable
Adding a New Agent
Define Agent in AGENTS Registry
Add your agent definition to the Key fields:
AGENTS record in src/session-manager.ts:src/session-manager.ts
name: Unique agent identifier (must match typeAgentName)displayName: Human-readable name for logsprerequisites: Array of agent names that must complete firstpromptTemplate: Filename inprompts/directory (without.txt)deliverableFilename: Output markdown file saved todeliverables/modelTier:'small','medium', or'large'(defaults to medium)
The
deliverableFilename must match the constants in mcp-server/src/types/deliverables.ts:DELIVERABLE_FILENAMES for the save_deliverable MCP tool to accept it.Update Type Definitions
Add your agent name to the type definitions in Also update the phase mapping:
src/types/agents.ts:src/types/agents.ts
src/session-manager.ts
Create Prompt Template
Create a new prompt template file in the Your prompt template should include:
prompts/ directory:- Clear objective and success criteria
- Variable placeholders:
{{TARGET_URL}},{{CONFIG_CONTEXT}},{{LOGIN_INSTRUCTIONS}} - Instructions for using available tools (browser, file system, deliverable saving)
- Expected deliverable format
- Examples of what to look for
prompts/vuln-csrf.txt
Add Activity Wrapper (Temporal)
Add a thin activity wrapper in The
src/temporal/activities.ts:src/temporal/activities.ts
runAgentActivity helper delegates to AgentExecutionService.execute(), which handles:- Prompt loading and variable substitution
- Git checkpoint creation
- Claude SDK execution
- Deliverable validation
- Metrics collection
- Error handling and retry
Register in Temporal Workflow
Add your agent to the appropriate phase in This integrates your agent into the parallel vulnerability→exploitation pipeline.
src/temporal/workflows.ts.For vulnerability/exploitation pipeline agents, add to the buildPipelineConfigs() function:src/temporal/workflows.ts
Add Agent Validator
Add a validator function in The factory functions
src/session-manager.ts to check if the agent completed successfully:src/session-manager.ts
createVulnValidator() and createExploitValidator() handle standard validation patterns.Add MCP Agent Mapping (for Browser Testing)
If your agent needs browser automation, assign it to a Playwright MCP server:Shannon has 5 Playwright agents (
src/session-manager.ts
playwright-agent1 through playwright-agent5) for browser isolation during parallel execution.Agent Execution Lifecycle
When your agent runs,AgentExecutionService.execute() follows this 9-phase lifecycle:
- Load prompt template from
prompts/{promptTemplate}.txt - Substitute variables (
{{TARGET_URL}}, etc.) - Create git checkpoint for rollback if needed
- Initialize Claude SDK with MCP servers
- Execute agent (up to 10,000 turns)
- Validate deliverable using agent validator
- Collect metrics (duration, cost, tokens, turns)
- Log completion with summary
- Return metrics to Temporal workflow
If the agent fails validation (missing deliverable), the git checkpoint is automatically rolled back to maintain clean state.
Best Practices
Single Responsibility
Each agent should focus on one vulnerability type or testing phase
Clear Deliverables
Define exactly what the agent should save and in what format
Progressive Analysis
Build on previous agents’ deliverables rather than starting from scratch
Explicit Prerequisites
Declare all dependencies in the
prerequisites arrayPrompt Writing Tips
- Be specific: Define exactly what to test and what constitutes a finding
- Use examples: Show sample vulnerable code patterns
- Structured output: Request deliverables in a consistent markdown format
- Tool guidance: Explain when to use browser vs. CLI vs. code analysis
- Success criteria: Define what “complete” looks like
Testing Your Agent
- Start with PIPELINE_TESTING=true for fast feedback
- Check deliverable format matches your validator expectations
- Verify metrics are being collected correctly
- Test resume functionality by interrupting and restarting
- Run on real vulnerable apps (OWASP Juice Shop, WebGoat, etc.)
Example: Complete CSRF Agent Addition
See the full example in the Shannon repository:- Agent definitions:
src/session-manager.ts:30-64 - Workflow integration:
src/temporal/workflows.ts:250-295 - Activity wrappers:
src/temporal/activities.ts:95-126 - Prompt templates:
prompts/vuln-*.txt,prompts/exploit-*.txt
Troubleshooting
Agent not executing
Agent not executing
- Check that
AgentNametype includes your agent name - Verify agent is registered in
AGENTSrecord - Ensure activity is added to workflow phase
- Check prerequisites are satisfied
Deliverable validation failing
Deliverable validation failing
- Verify
deliverableFilenamematches MCP server expectations - Check file was actually saved to
deliverables/directory - Ensure validator function is checking correct path
- Review agent logs for save_deliverable errors
Agent validator not found
Agent validator not found
- Add validator to
AGENT_VALIDATORSrecord - Use factory functions for standard patterns
- Ensure validator signature matches
AgentValidatortype
Prompt template not loading
Prompt template not loading
- Check file exists:
prompts/{promptTemplate}.txt - Verify
promptTemplatefield matches filename (without.txt) - Review logs for PromptManager errors
Next Steps
Modifying Prompts
Learn about prompt engineering and testing
Design Patterns
Understand Shannon’s architectural patterns
Agent Registry
Complete agent registry reference
Error Handling
Handle errors and retries correctly
