Orchestrata Ultimate / Specs / 067-remote-trigger-tool
067-remote-trigger-tool: RemoteTriggerTool - Remote Webhook/API Trigger
A tool that triggers remote webhooks or API calls with support for various authentication methods, request/response handling, retry logic, and result validation.
At a glance
| Item | Value |
|---|---|
| Spec directory | specs/067-remote-trigger-tool/ |
| Status line in the spec | Complete |
| Requirement IDs defined | 23 |
With a @traces citation in src/ |
23 (100.0%) |
With a @traces citation in tests/ |
0 (0.0%) |
| Tracked files | 3 |
| RTM page | 067-remote-trigger-tool |
Reading this spec
This spec defines RemoteTriggerTool, a tool that fires remote webhooks and calls third-party APIs, so agents can integrate with external services, trigger automated workflows (such as a CI/CD pipeline), take part in event-driven architectures and chain multi-step API calls. It handles authentication, request and response processing, retries and result validation.
Three user stories give the scope: a CI/CD pipeline trigger, external service integration and multi-step API chaining. The design is an HTTP/HTTPS client with connection pooling, several authentication schemes (API key, bearer token, basic auth, OAuth2 and HMAC), request and response transformation, retry with exponential backoff, and webhook signature verification. The functional requirements (FR-001 onward) cover HTTP request execution, authentication support, request configuration, retry logic, response validation and timeout handling.
The 23 requirement IDs (REQ-067-NNN) pin down the details. Requests use GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS with configurable headers, body and query parameters. A numeric Retry-After response header sets the delay before the next attempt. Response validation uses a lightweight JSON Schema subset (type, required, properties and items). The connection pool is a configurable httpx.Limits pool scoped to one execute call. Logs record method, sanitized URL, status, elapsed time and retry count, and sensitive headers are sanitized in them. A public verify_signature method checks a payload against a signature, secret and algorithm.
The implementation is in the remote trigger tool module. The requirements traceability matrix lists each ID. The spec's own status line reads Complete and it tracks 3 files. Measured coverage is 23 of 23 requirements cited by at least one @traces in src/ (100.0%), spread over 1 module; the module citing the most of them is orchestrata_ultimate/tools/remote_trigger_tool (23 requirements). In tests/, 0 requirements are cited by a test-side @traces, so test-side citations are thinner than code-side ones.
Requirements
Checkbox is the state recorded in the requirements checklist; Traced by is the count of src/ symbols whose @traces names the ID.
| ID | Done | Requirement | Traced by |
|---|---|---|---|
REQ-067-001 |
yes | Execute HTTP requests (GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS) to a configured URL with configurable headers/body. | 8 |
REQ-067-002 |
yes | API Key authentication, placed in a header or a query parameter (in: header|query). |
4 |
REQ-067-003 |
yes | Bearer Token authentication, literal or resolved from an env var (token_env). |
5 |
REQ-067-004 |
yes | Basic authentication (Base64-encoded username:password, password literal or password_env). |
3 |
REQ-067-005 |
yes | OAuth2 client-credentials token fetch (POST to token_url, resulting access_token used as Bearer). Token-refresh/caching lifecycle deferred (MVP: one fetch per request). |
3 |
REQ-067-006 |
yes | HMAC request signing (sha256/sha512/sha1) — computes a signature over the request body and injects it as a configurable header, secret literal or secret_env. |
5 |
REQ-067-007 |
yes | Configurable HTTP method, custom headers, request body (JSON object/array or raw string), and query parameters. | 3 |
REQ-067-008 |
yes | Configurable max attempts, exponential backoff (initial_delay * backoff_factor ** attempt, capped at max_delay), and configurable retryable status codes. |
4 |
REQ-067-009 |
yes | Retry on request timeout (retry_on_timeout). |
3 |
REQ-067-010 |
yes | Respects a numeric Retry-After response header (ERR-005) as the next-attempt delay. |
4 |
REQ-067-011 |
yes | Validate against expected HTTP status codes (defaults to 2xx when unset). | 4 |
REQ-067-012 |
yes | Validate response-time thresholds (min_response_time/max_response_time). |
3 |
REQ-067-013 |
yes | JSON Schema validation — lightweight subset (type/required/properties/items; no format/pattern/enum/$ref, no external jsonschema dependency). |
5 |
REQ-067-014 |
yes | Webhook HMAC signature verification (verify_signature + ValidationConfig.signature_secret(_env)). |
4 |
REQ-067-015 |
yes | Configurable per-request timeout with a clear timeout error message ("Request timeout after {n} seconds"). | 2 |
REQ-067-016 |
yes | Configurable httpx.Limits connection pool (connection_pool_size), scoped to the lifetime of one execute/execute_simple call (see module docstring fork note — no cross-call persistent client). |
2 |
REQ-067-017 |
yes | SSL verification enabled by default; custom CA bundle path (ca_bundle_path) supported; disabling verification (verify_ssl=false) logs a warning. |
2 |
REQ-067-018 |
yes | Parses JSON responses (content-type aware, falls back to raw text) and extracts dotted-path fields (extract_fields) into the response. Response-format conversion (e.g. XML->JSON) deferred. |
6 |
REQ-067-019 |
yes | Logs request/response (method, sanitized URL, status, elapsed ms, retry count) and sanitizes sensitive headers (Authorization, X-API-Key) before any debug-level header log. |
3 |
REQ-067-020 |
yes | Blocks outbound requests to loopback/private/link-local/reserved addresses and known metadata hostnames/IPs (single-resolution check via socket.getaddrinfo), overridable per-request (allow_internal) or via REMOTE_TRIGGER_ALLOW_PRIVATE (read at call time). DNS-rebinding protection and an allowlist are deferred. |
5 |
REQ-067-021 |
yes | execute_simple(url, method, headers, body, auth, timeout, env) simplified interface. |
2 |
REQ-067-022 |
yes | verify_signature(payload, signature, secret, algorithm) public method. |
3 |
REQ-067-023 |
yes | ERR-00N conditions (invalid URL, auth failure, forbidden, not found, rate limited, server error, timeout, connection error, SSL error, invalid signature, retry exhausted, invalid config, DNS failure) surfaced as RemoteTriggerError/TriggerResponse.error with the spec.md wording. |
5 |
Code that traces this spec
| Module | Symbols | Requirements |
|---|---|---|
orchestrata_ultimate/tools/remote_trigger_tool |
43 | 23 |
Checklists
checklists/requirements.md
The requirement list above comes from this file; 23 of 23 checkbox items are ticked.
Other tracked files
specs/067-remote-trigger-tool/compliance-audit.md
Full spec text
Verbatim from specs/067-remote-trigger-tool/spec.md; headings are pushed down two levels.
SPEC-067: RemoteTriggerTool - Remote Webhook/API Trigger
Metadata
- Spec ID: 067-remote-trigger-tool
- Title: RemoteTriggerTool - Remote Webhook/API Trigger
- Author: Mohamed
- Status: Complete
- Created: 2026-04-08
- Last Updated: 2026-04-09
- Priority: P1
- Version: 1.0.0
Overview
What
A tool that triggers remote webhooks or API calls with support for various authentication methods, request/response handling, retry logic, and result validation.
Why
- Integrate with external services via webhooks
- Trigger automated workflows
- Call third-party APIs
- Event-driven architectures
- Microservice orchestration
How
- HTTP/HTTPS client with connection pooling
- Multiple authentication schemes (API Key, Bearer Token, Basic Auth, OAuth2, HMAC)
- Request/response transformation
- Retry with exponential backoff
- Webhook signature verification
User Scenarios
US-001: CI/CD Pipeline Trigger
As a DevOps engineer
I want to trigger a GitHub Actions workflow remotely
So that I can automate deployments when code is pushed to a branch
Acceptance Criteria:
- Tool sends POST request to GitHub API repository dispatch endpoint
- Includes Bearer token authentication
- Payload contains event_type and client_payload
- Receives 204 No Content on success
- Retry logic handles transient failures
US-002: External Service Integration
As a application developer
I want to notify external services via webhooks
So that I can integrate with third-party systems and external workflows
Acceptance Criteria:
- Tool sends webhook to Slack Incoming Webhook URL
- Authentication uses webhook secret in header
- JSON payload contains formatted message and channel
- Receives 200 OK response
- Validation confirms {"ok": true} response
US-003: Multi-Step API Chaining
As a workflow orchestrator
I want to chain multiple API calls with polling for results
So that I can manage long-running processes and dependent tasks
Acceptance Criteria:
- Tool makes initial POST to start long-running process
- Polls GET endpoint for job completion using returned ID
- Implements exponential backoff retry logic
- Returns final status with sync results
- Handles timeout and retry exhaustion gracefully
Terminology
Core Concepts
- Webhook: HTTP callback sent to a specific URL when an event occurs
- API Call: Direct HTTP request to a RESTful or GraphQL endpoint
- Authentication: Mechanism to verify identity (API Key, Bearer, OAuth2, HMAC, Basic)
- Retry Logic: Automatic re-attempting of failed requests with exponential backoff
- Connection Pool: Reusable HTTP connections for performance optimization
- SSL/TLS Verification: Validation of server certificates for secure communication
- Webhook Signature: HMAC hash used to verify authenticity of webhook payloads
- Timeout: Maximum time to wait for response before aborting request
- Rate Limiting: API restriction on request frequency to prevent abuse
Key Components
- RemoteTriggerTool: Main tool class for executing remote triggers
- TriggerRequest: Configuration object for trigger execution
- TriggerResponse: Result object returned after trigger execution
- AuthConfig: Authentication configuration for various auth methods
- RetryConfig: Retry behavior configuration
- ValidationConfig: Response validation configuration
Data Models
JSON Schemas
TriggerRequest
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TriggerRequest",
"type": "object",
"required": ["url", "method"],
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "Target webhook or API endpoint URL"
},
"method": {
"type": "string",
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
"description": "HTTP method"
},
"headers": {
"type": "object",
"additionalProperties": {"type": "string"},
"description": "Custom headers"
},
"body": {
"type": ["object", "string", "number", "boolean", "array", "null"],
"description": "Request body (for POST, PUT, PATCH)"
},
"auth": {
"$ref": "#/definitions/AuthConfig"
},
"timeout": {
"type": "integer",
"minimum": 1,
"maximum": 300,
"default": 30,
"description": "Request timeout in seconds"
},
"retry": {
"$ref": "#/definitions/RetryConfig"
},
"validation": {
"$ref": "#/definitions/ValidationConfig"
}
},
"definitions": {
"AuthConfig": {
"type": "object",
"oneOf": [
{"$ref": "#/definitions/ApiKeyAuth"},
{"$ref": "#/definitions/BearerAuth"},
{"$ref": "#/definitions/BasicAuth"},
{"$ref": "#/definitions/OAuth2Auth"},
{"$ref": "#/definitions/HmacAuth"}
]
},
"ApiKeyAuth": {
"type": "object",
"required": ["type", "key", "value"],
"properties": {
"type": {"const": "api_key"},
"key": {"type": "string"},
"value": {"type": "string"},
"in": {"type": "string", "enum": ["header", "query"]}
}
},
"BearerAuth": {
"type": "object",
"required": ["type", "token"],
"properties": {
"type": {"const": "bearer"},
"token": {"type": "string"},
"token_env": {"type": "string", "description": "Environment variable name for token"}
}
},
"BasicAuth": {
"type": "object",
"required": ["type", "username"],
"properties": {
"type": {"const": "basic"},
"username": {"type": "string"},
"password": {"type": "string"},
"password_env": {"type": "string", "description": "Environment variable name for password"}
}
},
"OAuth2Auth": {
"type": "object",
"required": ["type", "client_id", "token_url"],
"properties": {
"type": {"const": "oauth2"},
"client_id": {"type": "string"},
"client_secret": {"type": "string"},
"client_secret_env": {"type": "string"},
"token_url": {"type": "string", "format": "uri"},
"scopes": {"type": "array", "items": {"type": "string"}},
"grant_type": {"type": "string", "enum": ["client_credentials", "password"]}
}
},
"HmacAuth": {
"type": "object",
"required": ["type", "secret", "algorithm"],
"properties": {
"type": {"const": "hmac"},
"secret": {"type": "string"},
"secret_env": {"type": "string"},
"algorithm": {"type": "string", "enum": ["sha256", "sha512", "sha1"]},
"header_name": {"type": "string", "default": "X-Signature"}
}
},
"RetryConfig": {
"type": "object",
"properties": {
"enabled": {"type": "boolean", "default": true},
"max_attempts": {"type": "integer", "minimum": 1, "maximum": 10, "default": 3},
"initial_delay": {"type": "number", "minimum": 0.1, "default": 1.0},
"max_delay": {"type": "number", "minimum": 1, "default": 60.0},
"backoff_factor": {"type": "number", "minimum": 1, "default": 2.0},
"retry_on_status": {"type": "array", "items": {"type": "integer"}, "default": [429, 500, 502, 503, 504]}
}
},
"ValidationConfig": {
"type": "object",
"properties": {
"expected_status": {"type": "array", "items": {"type": "integer"}},
"min_response_time": {"type": "number", "description": "Minimum expected response time in seconds"},
"max_response_time": {"type": "number", "description": "Maximum allowed response time in seconds"},
"schema": {"type": "object", "description": "JSON schema to validate response against"},
"signature_secret": {"type": "string", "description": "Secret for webhook signature verification"},
"signature_header": {"type": "string", "default": "X-Signature"}
}
}
}
}
TriggerResponse
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TriggerResponse",
"type": "object",
"required": ["success", "status_code", "timestamp"],
"properties": {
"success": {"type": "boolean"},
"status_code": {"type": "integer"},
"status_text": {"type": "string"},
"timestamp": {"type": "string", "format": "date-time"},
"elapsed_ms": {"type": "integer"},
"headers": {"type": "object", "additionalProperties": {"type": "string"}},
"body": {},
"validation_passed": {"type": "boolean"},
"validation_errors": {"type": "array", "items": {"type": "string"}},
"retry_count": {"type": "integer"},
"error": {"type": "string"}
}
}
WebhookEvent
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "WebhookEvent",
"type": "object",
"required": ["id", "source", "timestamp"],
"properties": {
"id": {"type": "string", "format": "uuid"},
"source": {"type": "string"},
"timestamp": {"type": "string", "format": "date-time"},
"payload": {"type": "object"},
"headers": {"type": "object", "additionalProperties": {"type": "string"}},
"signature_valid": {"type": "boolean"}
}
}
Functional Requirements
FR-001: HTTP Request Execution
The tool MUST execute HTTP requests to specified URLs with configurable method, headers, and body.
FR-002: Authentication Support
The tool MUST support multiple authentication methods:
- API Key (header or query parameter)
- Bearer Token
- Basic Authentication
- OAuth2 Client Credentials
- HMAC Signature
FR-003: Request Configuration
The tool MUST allow configuration of:
- HTTP method
- Custom headers
- Request body (JSON, form-data, raw)
- Query parameters
- Content-Type
FR-004: Retry Logic
The tool MUST implement configurable retry logic with:
- Configurable max attempts
- Exponential backoff
- Configurable retryable status codes
- Retry on timeout
FR-005: Response Validation
The tool MUST validate responses against:
- Expected HTTP status codes
- Response time thresholds
- JSON schema validation
- Webhook signature verification
FR-006: Timeout Handling
The tool MUST handle timeouts gracefully with:
- Configurable timeout per request
- Clear timeout error messages
- Configurable retry behavior on timeout
FR-007: Connection Pooling
The tool MUST implement connection pooling for:
- Reuse of connections
- Configurable pool size
- Connection lifecycle management
FR-008: SSL/TLS Verification
The tool MUST:
- Verify SSL certificates by default
- Allow configuration of custom CA certificates
- Support disabling SSL verification (with warning)
FR-009: Response Transformation
The tool MUST support response transformation:
- Parse JSON responses
- Extract specific fields from responses
- Convert response formats
FR-010: Logging and Auditing
The tool MUST:
- Log all requests with sanitized sensitive data
- Track request/response timing
- Provide detailed error information
- Support structured logging
FR-011: Webhook Signature Verification
The tool MUST verify webhook signatures:
- Support HMAC-SHA256 signatures
- Support custom signature algorithms
- Configurable secret storage
Error Conditions
| ID | Condition | Handling |
|---|---|---|
| ERR-001 | Invalid URL | Reject with 400 status and "Invalid or malformed URL: {url}" |
| ERR-002 | Authentication Failure | Report 401 status with "Authentication failed: {reason}" |
| ERR-003 | Forbidden Access | Report 403 status with "Access forbidden to {url}" |
| ERR-004 | Endpoint Not Found | Report 404 status with "Endpoint not found: {url}" |
| ERR-005 | Rate Limiting | Handle 429 status with "Rate limit exceeded. Retry after {retry_after} seconds" |
| ERR-006 | Server Error | Report 5xx status with "Server error: {status_code}" |
| ERR-007 | Timeout | Report "Request timeout after {timeout} seconds" |
| ERR-008 | Connection Error | Report "Failed to connect to {host}: {reason}" |
| ERR-009 | SSL Verification Failed | Report "SSL certificate verification failed: {reason}" |
| ERR-010 | Invalid Response | Report "Response validation failed: {validation_error}" |
| ERR-011 | Invalid Signature | Report "Webhook signature verification failed" |
| ERR-012 | Retry Exhausted | Report "Max retry attempts ({max_attempts}) exceeded" |
| ERR-013 | Invalid Configuration | Report "Configuration error: {detail}" |
| ERR-014 | Body Too Large | Report 413 status with "Request body exceeds maximum size of {max_size} bytes" |
| ERR-015 | DNS Resolution Failure | Report "Failed to resolve DNS for {hostname}" |
| ERR-016 | Invalid JSON Payload | Report "Invalid JSON in request body: {error}" |
| ERR-017 | Content Type Mismatch | Report "Unexpected content type: {content_type}" |
API Contracts
Tool Interface
class RemoteTriggerTool(BaseTool):
"""Trigger remote webhooks and API calls."""
name = "remote_trigger"
description = "Trigger remote webhooks or API calls with authentication"
async def execute(
self,
request: TriggerRequest
) -> TriggerResponse:
"""Execute a remote trigger request."""
async def execute_simple(
self,
url: str,
method: str = "POST",
headers: dict = None,
body: dict = None,
auth: AuthConfig = None,
timeout: int = 30
) -> TriggerResponse:
"""Simplified interface for basic triggers."""
async def verify_signature(
self,
payload: bytes,
signature: str,
secret: str,
algorithm: str = "sha256"
) -> bool:
"""Verify webhook signature."""
async def parse_response(
self,
response: Response,
validation: ValidationConfig = None
) -> dict:
"""Parse and validate response."""
Configuration Schema
class RemoteTriggerConfig(BaseModel):
"""Tool configuration."""
timeout_default: int = Field(default=30, ge=1, le=300)
max_retries: int = Field(default=3, ge=0, le=10)
retry_backoff_factor: float = Field(default=2.0, ge=1.0)
connection_pool_size: int = Field(default=10, ge=1, le=100)
verify_ssl: bool = True
ca_bundle_path: str = None
default_headers: dict = {}
log_requests: bool = True
sensitive_headers: list[str] = ["Authorization", "X-API-Key"]
Public Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
execute |
request: TriggerRequest |
TriggerResponse |
Execute trigger with full config |
execute_simple |
url, method, headers, body, auth, timeout |
TriggerResponse |
Simplified trigger |
verify_signature |
payload, signature, secret, algorithm |
bool |
Verify HMAC signature |
parse_response |
response, validation |
dict |
Parse and validate response |
Non-Functional Requirements
Performance
- Response Time: Maximum 100ms overhead for local HTTP requests
- Throughput: Support 100+ concurrent requests with connection pooling
- Connection Pool: Configurable pool size (1-100 connections, default 10)
- Timeout: Configurable per-request (1-300 seconds, default 30)
Reliability
- Retry Success Rate: 99.9% for transient failures with retry logic
- Connection Stability: Keep-alive connections with proper lifecycle management
- Graceful Degradation: Clear error messages for all failure modes
Scalability
- Horizontal Scaling: Stateless design supports multiple instances
- Resource Limits: Configurable limits prevent resource exhaustion
- Rate Limiting: Built-in rate limiting per agent/endpoint
Security
- SSL/TLS: Enabled by default, custom CA bundle support
- Credential Storage: Environment variable-based secret management
- Log Sanitization: All sensitive data redacted in logs
- SSRF Protection: Block localhost, metadata endpoints, internal IPs
Maintainability
- Modular Design: Separate auth, retry, validation modules
- Configuration: YAML-based configuration with schema validation
- Observability: Structured logging with request tracing
Technical Design
Architecture Overview
The RemoteTriggerTool follows a layered architecture:
┌─────────────────────────────────────────┐
│ RemoteTriggerTool │
├─────────────────────────────────────────┤
│ ┌─────────┐ ┌─────────┐ ┌──────────┐ │
│ │ Auth │ │ Retry │ │ Validate│ │
│ │ Manager │ │ Logic │ │ Module │ │
│ └─────────┘ └─────────┘ └──────────┘ │
├─────────────────────────────────────────┤
│ HTTP Client (httpx) │
├─────────────────────────────────────────┤
│ Connection Pool Manager │
└─────────────────────────────────────────┘
Core Components
TriggerRequestProcessor
- Validates incoming TriggerRequest
- Applies authentication configuration
- Executes HTTP request via client
- Handles response validation
AuthenticationManager
- Supports multiple auth schemes via strategy pattern
- Handles credential loading from environment
- Manages OAuth2 token refresh lifecycle
- Generates HMAC signatures
RetryExecutor
- Implements exponential backoff algorithm
- Configurable retryable status codes
- Respects Retry-After headers
- Limits retry attempts
ResponseValidator
- Status code validation
- JSON schema validation
- Response time threshold checking
- Webhook signature verification
SSRFProtection
- URL allowlist validation
- Blocked hostname detection
- Internal IP blocking
- DNS rebinding prevention
Data Flow
- Client calls
execute(trigger_request) - Request validation (URL format, auth config, timeout)
- AuthManager applies authentication headers
- RetryExecutor makes HTTP call with retry logic
- ResponseValidator checks response
- TriggerResponse returned with results
Extension Points
- Custom HTTP backends via adapter interface
- Additional authentication schemes
- Custom response transformers
- Webhook signature algorithms
Examples
remote_trigger:
defaults:
timeout: 30
verify_ssl: true
max_retries: 3
retry_backoff_factor: 2.0
connection_pool_size: 10
auth:
github:
type: bearer
token_env: GITHUB_TOKEN
slack:
type: api_key
key: X-Slack-Secret
value_env: SLACK_SECRET
in: header
custom_service:
type: oauth2
client_id_env: OAUTH_CLIENT_ID
client_secret_env: OAUTH_CLIENT_SECRET
token_url: https://auth.example.com/oauth/token
scopes: ["api:read", "api:write"]
endpoints:
deployments:
url: https://api.example.com/deployments
auth: custom_service
expected_status: [201, 202]
notifications:
url: https://hooks.example.com/notify
auth: slack
expected_status: [200]
Security Requirements
Authentication
API Key Authentication
- Keys MUST be stored securely (environment variables preferred)
- Keys MUST be redacted in logs
- Support for header and query parameter placement
Bearer Token Authentication
- Tokens MUST be obtained securely
- Token refresh MUST be handled automatically for OAuth2
- Tokens MUST be redacted in logs
Basic Authentication
- Credentials MUST be Base64 encoded (not encrypted) in transit
- HTTPS MUST be enforced for basic auth
- Credentials MUST be redacted in logs
OAuth2 Client Credentials
- Automatic token refresh
- Secure token storage
- Scope validation
HMAC Signature
- Support for SHA256, SHA512, SHA1 algorithms
- Timestamp validation to prevent replay attacks
- Configurable header for signature placement
Encryption
Transport Layer
- HTTPS MUST be used for all production requests
- SSL/TLS certificate verification MUST be enabled by default
- Custom CA bundles MUST be supported
- Certificate pinning SHOULD be supported
Data at Rest
- No sensitive data stored in tool configuration
- Secrets MUST be retrieved from secure storage
Result Validation
Status Code Validation
- Configurable expected status codes
- Default to 2xx success codes
- Configurable handling of non-2xx responses
Response Schema Validation
- JSON Schema validation for responses
- Support for partial schema validation
- Detailed validation error reporting
Signature Verification
- HMAC-SHA256 verification for webhooks
- Configurable signature header
- Timestamp validation
Input Validation
- URL format validation
- HTTP method validation
- Header value sanitization
- Body size limits
Audit Logging
- Log all requests (sanitized)
- Track authentication attempts
- Record validation failures
- Monitor for anomalous patterns
Governance
Policy Enforcement
- Remote triggers require tool:execute permission
- SSRF protection enforced for all outbound requests
- Rate limits applied based on agent tier
- HTTPS required for sensitive endpoints (auth, payment)
- Webhook signature verification enabled by default
SSRF Protection
The tool MUST implement SSRF protection including:
- Blocked URL patterns (localhost, 127.0.0.1, metadata endpoints)
- Allowlist-based hostname validation
- DNS rebinding attack prevention
- Internal IP address blocking
Rate Limiting Rules
- Default: 100 requests per 60 seconds per agent
- Configurable per-endpoint rate limits
- Retry-after header respect for 429 responses
Audit Logging
All remote trigger events MUST be logged including:
- Event type, timestamp, agent identity
- Target URL (sanitized)
- HTTP method, status code
- Request/response duration
- Success/failure status
async def log_trigger(url: str, result: dict):
await audit_log({
"event_type": "remote_trigger",
"url": sanitize_url(url),
"method": result.method,
"status_code": result.status_code,
"success": result.success,
"duration_ms": result.duration_ms,
"agent": get_current_agent()
})
Governance Rules (Prolog)
% RemoteTriggerTool governance rules
% Allow trigger to non-sensitive endpoints
may_trigger(Agent, Endpoint) :-
non_sensitive_endpoint(Endpoint),
has_permission(Agent, webhook_trigger).
% Block trigger to sensitive endpoints without elevated permission
may_trigger(Agent, Endpoint) :-
sensitive_endpoint(Endpoint),
has_permission(Agent, webhook_trigger_elevated),
audit_log(Agent, Endpoint).
% Sensitive endpoint patterns
sensitive_endpoint(Endpoint) :-
contains(Endpoint, "production"),
contains(Endpoint, "admin").
% Non-sensitive endpoint patterns
non_sensitive_endpoint(Endpoint) :-
not contains(Endpoint, "admin"),
not contains(Endpoint, "/internal/").
% Rate limiting rules
rate_limit(Agent, Endpoint, Requests) :-
Requests =< 100,
time_window(Agent, 60, Requests).
% Require HTTPS for sensitive data
require_https(Endpoint) :-
contains(Endpoint, "auth"),
contains(Endpoint, "payment"),
not contains(Endpoint, "http://localhost").
Dependencies
Runtime Dependencies
| Package | Version | Purpose |
|---|---|---|
httpx |
>=0.27.0 | HTTP client with async support |
pydantic |
>=2.0.0 | Data validation |
python-jose |
>=3.3.0 | JWT/OAuth2 token handling |
cryptography |
>=41.0.0 | HMAC signature generation |
Development Dependencies
| Package | Version | Purpose |
|---|---|---|
pytest |
>=7.0.0 | Testing framework |
pytest-asyncio |
>=0.21.0 | Async test support |
pytest-cov |
>=4.0.0 | Coverage reporting |
respx |
>=0.20.0 | HTTP mocking |
ruff |
>=0.1.0 | Linting |
Optional Dependencies
| Package | Version | Purpose |
|---|---|---|
aiohttp |
>=3.9.0 | Alternative HTTP backend |
urllib3 |
>=2.0.0 | Connection pooling |
Testing Requirements
Unit Tests
Authentication Tests
- [ ] Test API key authentication in header
- [ ] Test API key authentication in query
- [ ] Test Bearer token authentication
- [ ] Test Basic authentication encoding
- [ ] Test OAuth2 token refresh
- [ ] Test HMAC signature generation
- [ ] Test HMAC signature verification
Request Execution Tests
- [ ] Test GET request
- [ ] Test POST with JSON body
- [ ] Test POST with form data
- [ ] Test PUT request
- [ ] Test PATCH request
- [ ] Test DELETE request
- [ ] Test custom headers
- [ ] Test query parameters
Retry Logic Tests
- [ ] Test retry on 429 status
- [ ] Test retry on 5xx status
- [ ] Test retry on timeout
- [ ] Test exponential backoff
- [ ] Test max retry limit
- [ ] Test no retry for non-retryable errors
Validation Tests
- [ ] Test expected status validation
- [ ] Test JSON schema validation
- [ ] Test response time validation
- [ ] Test webhook signature verification
Integration Tests
Real HTTP Tests
- [ ] Test against httpbin.org
- [ ] Test against mock HTTP server
- [ ] Test SSL verification
- [ ] Test custom CA bundle
- [ ] Test connection pooling
End-to-End Scenarios
- [ ] Test GitHub API dispatch
- [ ] Test Slack webhook
- [ ] Test OAuth2 flow
- [ ] Test multi-step chaining
Error Handling Tests
Error Condition Tests
- [ ] Test invalid URL handling
- [ ] Test authentication failure handling
- [ ] Test rate limit handling
- [ ] Test timeout handling
- [ ] Test SSL error handling
- [ ] Test validation failure handling
- [ ] Test retry exhaustion handling
Performance Tests
- [ ] Test connection pool efficiency
- [ ] Test concurrent requests
- [ ] Test large response handling
- [ ] Test request/response latency
Integration Points
HTTP Client Integration
- Uses
httpxasync HTTP client for request execution - Supports custom HTTP backends via adapter pattern
- Connection pooling via urllib3
Authentication Providers
- GitHub API: Bearer token authentication
- Slack: Webhook secret + API key
- Generic OAuth2: Client credentials flow
- Custom: API key, Basic, HMAC
Event Systems
- Emits trigger events to audit system
- Supports webhook delivery status callbacks
- Publishes metrics to monitoring systems
Configuration Management
- YAML-based configuration loading
- Environment variable substitution for secrets
- Schema validation on startup
Success Criteria
Functional Success
- [ ] Execute HTTP requests with all supported methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
- [ ] Support all 5 authentication methods (API Key, Bearer, Basic, OAuth2, HMAC)
- [ ] Implement retry logic with exponential backoff (configurable)
- [ ] Validate responses against expected status codes
- [ ] Verify webhook signatures (HMAC-SHA256)
- [ ] Block SSRF attacks via URL validation
- [ ] Log all requests with sanitized sensitive data
Performance Success
- [ ] Request timeout configurable (1-300 seconds, default 30)
- [ ] Connection pool size configurable (1-100, default 10)
- [ ] Concurrent request handling with connection reuse
- [ ] Response time SLA: <100ms overhead for local requests
Reliability Success
- [ ] Retry on transient failures (429, 500, 502, 503, 504)
- [ ] Graceful timeout handling with clear error messages
- [ ] SSL/TLS certificate verification enabled by default
Security Success
- [ ] No credentials logged in plaintext
- [ ] SSRF protection blocks localhost and metadata endpoints
- [ ] HTTPS enforced for sensitive endpoints
- [ ] Webhook signature verification prevents tampering
Observability
Logging Requirements
- Component Logging
- Log all major operations with appropriate log levels
- Include correlation IDs for request tracing
- Log performance metrics for critical operations
- Log errors with full context for debugging
Metrics Requirements
- Performance Metrics
- Operation duration histograms
- Request/error rate counters
- Resource utilization gauges
- Business metrics relevant to domain
Tracing Requirements
- Distributed Tracing
- Trace propagation across component boundaries
- Span attributes for domain-specific context
- Trace sampling based on operational needs
Alerting Requirements
- Critical Alerts
- Error rate spikes
- Performance degradation
- Resource exhaustion
- Business metric anomalies
Dashboard Requirements
- Operational Dashboard
- Real-time system health
- Performance trends
- Error analysis
- Resource monitoring
Revision History
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2026-04-08 | Mohamed | Initial specification |
| 1.0.1 | 2026-04-09 | Mohamed | Fixed spec standard compliance, added missing sections, converted error conditions to table format |