Skip to content

Building Custom Agents

Emmu's architecture is highly modular. If you encounter a new class of vulnerability or a specific technology stack that the current agents struggle with, you can easily add a new Specialist.

[!NOTE] The Problem: Modifying monolithic system prompts to include new niche instructions degrades the model's overall performance.

The Solution: Create a micro-agent in specialists.py with a highly focused System Prompt, and expose only the specific MCP tools it needs to succeed.


1. Defining the Agent

To add a new agent, open core/emmu/agents/specialists.py. Locate the relevant category array (e.g., WEB_SPECIALISTS or INFRA_SPECIALISTS) and append a new dictionary definition.

{
    "id": "graphql_expert",
    "name": "GraphQL Security Specialist",
    "description": "Expert in analyzing and exploiting GraphQL APIs, Introspection, and query batching.",
    "tools": ["nuclei-mcp", "fetch", "graphql_introspection_tool"],
    "system_prompt": """You are an elite GraphQL security researcher.
Your primary goal is to map the schema using Introspection queries.
If Introspection is disabled, you must attempt field guessing using common wordlists.
Always check for query batching vulnerabilities to bypass rate limits.
Do not attempt standard SQL injection unless it is inside a GraphQL parameter."""
}

Key Components:

  • id: The unique identifier the Orchestrator uses to route tasks.
  • tools: A list of tool names (matching those in tools.py or your mcp.json). Only these tools will be injected into this agent's context.
  • system_prompt: Be explicit, technical, and strict.

2. Registering the Agent

Once added to the array, the SpecialistRegistry will automatically load it on the next boot. The AgentFactory will handle injecting the [BRIDGE PARITY] instructions into your custom system_prompt so your new agent instantly knows how to use its assigned tools.

3. Testing the Agent

Launch the Interactive CLI and test the routing:

python run.py
emmu> "Analyze the GraphQL endpoint at http://target/graphql for introspection."
You should see the Orchestrator print: [ROUTING] Selected Specialist: graphql_expert.