Integrating External Agents
Integrate custom AI agents with Edison Watch using the Python SDK or HTTP API for tracking, gating, and monitoring agent activity.
Edison Watch provides APIs and SDKs to integrate external AI agents, enabling you to track tool calls, enforce security policies, and monitor agent activity in real-time.
Prerequisites
Before integrating your agent:
- Edison Watch server must be running and accessible
- API key from the dashboard (Settings → API Keys)
- Python 3.8+ (for Python SDK) or HTTP client (for direct API)
Get your API key from the Edison Watch dashboard under Settings → API Keys. The API key authenticates your agent and associates activity with your user account.
Server Location: Set the EDISON_WATCH_API_BASE environment variable to your Edison Watch server URL (e.g., https://edison.example.com or http://localhost:3001). The SDK reads this value to connect to your server.
Quick Start (Python/LangGraph)
The fastest way to integrate is using the edison-watch Python SDK with the @edison.track() decorator.
Installation
Environment Variables
Set these environment variables (or pass them to the Edison constructor):
Required: You must set EDISON_WATCH_API_BASE to your Edison Watch server URL. This can be a local instance (http://localhost:3001) or a remote server (https://edison.example.com).
Minimal Integration
Add just 4 lines to track your agent's tool calls:
The @edison.track() decorator automatically:
- Sends tool call metadata to Edison Watch before execution
- Waits for approval if the call triggers security policies
- Records duration and result after execution
- Appears in the dashboard timeline
Registering Agents (Optional)
You can optionally register named agents in Edison Watch for better organization and tracking. This is useful when managing multiple agent types or roles.
Create an Agent
Response:
The agent_id is automatically generated in the format agent:HEX (32 hex characters).
List Agents
Response:
Delete an Agent
Response:
Agent registration is optional. You can use the tracking API directly without registering agents. Registration is mainly useful for administrative organization and reporting.
Edison SDK Reference
The Edison class provides a Python SDK for tracking agent activity.
Constructor
Environment Variables:
EDISON_WATCH_API_BASE: Server URL (required - set this to your Edison Watch server)EDISON_WATCH_API_KEY: API key for authentication (required)
If not provided as constructor arguments, these values are read from environment variables.
Tracking Decorator
The @edison.track() decorator wraps functions to track their execution:
Parameters:
session_id: Override the session ID for this callname: Override the tool name (defaults to function name)
Behavior:
- Calls
/agent/beginbefore execution (gating + approval wait) - Executes the function
- Calls
/agent/endafter execution with status, duration, and result summary - Raises
PermissionErrorif blocked and not approved
Wrapping LangChain Tools
For LangChain tools, use wrap_tools():
Or use bind_tools() to wrap and bind in one step:
Session Management
Sessions group related tool calls together. By default, each Edison instance creates a unique session ID, but you can share sessions:
You can also override the session per call:
Direct HTTP API (Non-Python)
If you're not using Python, you can integrate directly via HTTP endpoints.
Start Tracking a Tool Call
Response:
Status Codes:
200 OK: Request processed (checkapprovedfield)400 Bad Request: Invalid request body401 Unauthorized: Missing or invalid API key
Important: If approved is false, the tool call was blocked by security policies. Wait for manual approval in the dashboard, or handle the error appropriately.
Complete Tracking
After executing the tool, call /agent/end:
Response:
Tool Name Normalization
Tool names are automatically prefixed with agent_ if they don't already start with builtin_ or agent_:
web_search→agent_web_searchagent_my_tool→agent_my_tool(unchanged)builtin_system→builtin_system(unchanged)
Example: Complete Integration
Multi-Agent Setup
When running multiple agents with different roles or permissions, create separate Edison instances with distinct agent_name and agent_type:
Each agent's activity will be tracked separately in the dashboard, and you can configure different permissions per agent type through the dashboard's permissions settings.
Permissions Configuration
Tracked tools are named with the agent_ prefix in the permissions system. Configure them through the Edison Watch dashboard:
- Navigate to Servers in the dashboard
- Find or create the
agentserver (tools tracked via the SDK appear under this server) - Click on each tool to configure its permissions
Permission Settings:
For each tool, you can configure:
- Enabled: Whether the tool is allowed to run
- Write Operation: Tool can modify data (e.g., send email, create file)
- Read Private Data: Tool accesses sensitive internal data
- Read Untrusted Public Data: Tool processes external/untrusted content
- ACL: Access control level (PUBLIC, PRIVATE, SECRET, TOP_SECRET)
Example Configuration:
For a web_search tool tracked as agent_web_search:
- Enabled: ✓
- Write Operation: ✗
- Read Private Data: ✗
- Read Untrusted Public Data: ✓
- ACL: PUBLIC
For a send_email tool tracked as agent_send_email:
- Enabled: ✓
- Write Operation: ✓
- Read Private Data: ✗
- Read Untrusted Public Data: ✗
- ACL: SECRET
Security Flags:
write_operation: Tool can modify data (e.g., send email, create file)read_private_data: Tool accesses sensitive internal dataread_untrusted_public_data: Tool processes external/untrusted content
Lethal Trifecta: If a tool call combines all three flags (private data + untrusted content + write), Edison Watch will pause for manual approval.
ACL Levels:
PUBLIC: Non-sensitive dataPRIVATE: Confidential or internal dataSECRET: Highly sensitive data
Enforcement: Data cannot flow from a higher ACL to a lower one (e.g., SECRET → PUBLIC).
See Setting Permissions for detailed configuration guidance.
Error Handling
Blocked Tool Calls
If a tool call is blocked by security policies:
Network Errors
The SDK handles network errors gracefully and logs them. If Edison Watch is unreachable:
- Tool execution continues (best-effort tracking)
- Errors are logged but don't raise exceptions
- Health checks run in the background to detect connectivity
Timeout Handling
If manual approval times out (default: 30 seconds):
The timeout_s parameter controls how long to wait for approval before raising PermissionError.
Best Practices
- Use descriptive agent names:
hr_assistant,eng_copilot,finance_analyst - Set agent types: Group agents by role for easier management
- Share sessions appropriately: Use the same
session_idfor related tool calls in a conversation - Handle approvals gracefully: Blocked calls should wait for approval or fail gracefully
- Configure permissions upfront: Set up tool permissions in the dashboard before deploying agents
- Monitor the dashboard: Review agent activity and adjust permissions as needed
Troubleshooting
401 Unauthorized
- Check that
EDISON_WATCH_API_KEYis set correctly - Verify the API key is active in the dashboard
Tool calls blocked
- Check tool permissions in the dashboard (Servers → agent → Tools)
- Verify the tool name matches (with
agent_prefix) - Approve blocked calls in the dashboard if needed
Tool calls not appearing in dashboard
- Verify Edison Watch server is running
- Check network connectivity to
api_base - Review server logs for errors
Health check failures
- Ensure Edison Watch is accessible at
api_base - Check firewall/network settings
- Verify the server is running:
curl http://localhost:3001/health
Need help? Check the Dashboard guide for monitoring agent activity, or email [email protected] for support.

