Tool Architecture
Tool Registry
Tools are registered using the@register_tool decorator (esprit/tools/registry.py):
Registration Options
- sandbox_execution=True: Execute in isolated sandbox (default)
- sandbox_execution=False: Execute in CLI process (for coordination tasks)
Tool Schema
Each tool has an XML schema file defining its interface:Available Tools
Based onesprit/tools/__init__.py, the following tool modules are available:
Browser Tools
Module:esprit/tools/browser/Sandbox Execution: Yes
Description: Automated browser interactions using Playwright
Browser Tool Functions
Browser Tool Functions
- browser_navigate: Navigate to URL
- browser_click: Click element by selector
- browser_type: Type text into input field
- browser_screenshot: Capture page screenshot
- browser_extract_content: Extract text content from page
- browser_get_cookies: Retrieve browser cookies
- browser_close_tab: Close current browser tab
- browser_new_tab: Open new browser tab
- browser_execute_js: Execute JavaScript in page context
- Multi-tab support via
TabManager - Persistent browser instances per agent
- Automatic viewport configuration
- Screenshot support (base64-encoded PNG)
Terminal Tools
Module:esprit/tools/terminal/Sandbox Execution: Yes
Description: Shell command execution in sandbox
Terminal Tool Functions
Terminal Tool Functions
- terminal_run_command: Execute shell command
- terminal_list_sessions: List active terminal sessions
- terminal_get_session: Get terminal session info
- terminal_kill_session: Terminate terminal session
- Persistent terminal sessions (
TerminalSessionclass) - Command timeout enforcement (configurable via
ESPRIT_SANDBOX_EXECUTION_TIMEOUT) - Working directory management
- Environment variable support
File Edit Tools
Module:esprit/tools/file_edit/Sandbox Execution: Yes
Description: File system operations and code editing
File Edit Tool Functions
File Edit Tool Functions
- file_read: Read file contents
- file_write: Write content to file
- file_edit: Edit file with search/replace
- file_list: List directory contents
- file_delete: Delete file or directory
- file_create: Create new file
- file_search: Search for pattern in files
- All operations scoped to
/workspacedirectory - Edit tracking for scan diffs
- Glob pattern support for searches
- Safety checks to prevent destructive operations outside workspace
Proxy Tools
Module:esprit/tools/proxy/Sandbox Execution: Yes
Description: HTTP/HTTPS traffic interception using mitmproxy
Proxy Tool Functions
Proxy Tool Functions
- proxy_start: Start HTTP interception proxy
- proxy_stop: Stop proxy
- proxy_get_requests: Retrieve intercepted requests
- proxy_get_responses: Retrieve intercepted responses
- proxy_clear_history: Clear intercepted traffic
- proxy_export: Export traffic to HAR format
- Automatic HTTPS certificate handling
- Request/response modification support
- Traffic filtering by URL pattern
- HAR export for external analysis
Python Tools
Module:esprit/tools/python/Sandbox Execution: Yes
Description: Python code execution in isolated interpreter
Python Tool Functions
Python Tool Functions
- python_exec: Execute Python code
- python_eval: Evaluate Python expression
- python_install_package: Install pip package
- python_list_packages: List installed packages
- Persistent Python interpreter state per agent
- Package installation support
- Stdout/stderr capture
- Exception handling and traceback reporting
Agents Graph Tools
Module:esprit/tools/agents_graph/Sandbox Execution: No (local only)
Description: Multi-agent coordination and communication
Agents Graph Tool Functions
Agents Graph Tool Functions
- agent_create: Create new sub-agent
- agent_send_message: Send message to another agent
- agent_get_status: Get agent status
- agent_list_agents: List all agents
- agent_finish: Mark sub-agent as completed
- wait_for_message: Wait for messages from other agents
- Hierarchical agent relationships tracked in graph
- Message passing between agents
- Agent lifecycle management
- Status tracking (running, waiting, completed, failed)
Finish Tools
Module:esprit/tools/finish/Sandbox Execution: No
Description: Scan completion and result reporting
Finish Tool Functions
Finish Tool Functions
- finish_scan: Complete security scan (root agent only)
- Triggers scan completion and cleanup
- Generates final report
- Only callable by root agent
Thinking Tools
Module:esprit/tools/thinking/Sandbox Execution: No
Description: Internal reasoning and planning
Thinking Tool Functions
Thinking Tool Functions
- think: Record internal reasoning (not visible to user)
- Supports extended thinking mode
- Helps agents organize complex reasoning
- Not included in final output
Todo Tools
Module:esprit/tools/todo/Sandbox Execution: No
Description: Task planning and tracking
Todo Tool Functions
Todo Tool Functions
- todo_create: Create new todo item
- todo_update: Update todo status
- todo_list: List all todos
- todo_delete: Delete todo
- Helps agents organize multi-step tasks
- Status tracking (pending, in_progress, completed)
- Priority management
Reporting Tools
Module:esprit/tools/reporting/Sandbox Execution: No
Description: Generate structured security reports
Reporting Tool Functions
Reporting Tool Functions
- report_finding: Report security finding
- report_get_findings: Get all reported findings
- report_update_finding: Update existing finding
- Structured finding format (title, severity, description, remediation)
- CVSS scoring support
- Deduplication of similar findings
Notes Tools
Module:esprit/tools/notes/Sandbox Execution: No
Description: Agent note-taking and memory
Notes Tool Functions
Notes Tool Functions
- note_create: Create note
- note_list: List all notes
- note_get: Retrieve specific note
- note_delete: Delete note
- Persistent memory across iterations
- Key-value storage
- Useful for tracking state across long scans
Web Search Tools
Module:esprit/tools/web_search/Sandbox Execution: No
Description: External web search via Perplexity API
Web Search Tool Functions
Web Search Tool Functions
- web_search: Search the web for information
- Perplexity API key (
PERPLEXITY_API_KEYenvironment variable) - Only available when API key is configured
Tool Execution Flow
Sandbox Execution
For tools withsandbox_execution=True (esprit/tools/executor.py:31-101):
- Agent calls tool via
execute_tool(tool_name, **kwargs) - Tool executor retrieves sandbox URL from agent state
- HTTP POST request sent to
{sandbox_url}/execute: - Tool server in sandbox executes tool function
- Result returned as JSON:
- Result added to conversation as tool result message
Local Execution
For tools withsandbox_execution=False (esprit/tools/executor.py:103-117):
- Tool function retrieved from registry
- Arguments validated against schema
- Function called directly in CLI process
- Result returned immediately
Tool Validation
The tool executor performs validation (esprit/tools/executor.py:132-165):
Parameter Validation
Parameter Validation
- Checks for unknown parameters
- Ensures required parameters are present
- Validates parameter types (string, boolean, number, list, dict)
- Returns detailed error messages with schema hints
Availability Validation
Availability Validation
- Verifies tool exists in registry
- Lists available tools if requested tool not found
- Handles conditional tool loading (e.g., web_search only with API key)
Result Formatting
Tool results are wrapped in XML for LLM consumption (executor.py:253-258):
<result> content is returned.
Tool Server
The tool server (esprit/runtime/tool_server.py) runs inside each sandbox:
- FastAPI-based HTTP server on port 48081
- Bearer token authentication
- Executes tools in sandbox environment
- Maintains per-agent tool instances (browser, terminal, python)
- Tracks file edits for diff extraction
Creating Custom Tools
To add a new tool:- Create module in
esprit/tools/my_tool/ - Define tool function:
- Create XML schema file
my_tool_actions_schema.xml - Import in
esprit/tools/__init__.py:
Next Steps
Agent System
Learn how agents use tools
Docker Sandbox
Understand tool execution environments