automaton.proxy¶
WARNING
This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.
automaton.proxy
¶
Loopback model proxy for Automaton.
A host-side broker forwards HTTP requests from a sandboxed harness to the upstream model API while a sandbox-local HTTP proxy serves the harness on sandbox localhost. This split design lets Automaton inject authentication credentials, honor provider TLS configuration, and retry dropped upstream requests within a bounded deadline without exposing the host network to the sandbox.
ProviderExecutedToolBlocked
¶
Bases: RuntimeError
Raised when a request declares a provider-executed tool that is not allowed.
See :data:PROVIDER_EXECUTED_TOOL_TYPES for why these are blocked by
default.
Source code in automaton/proxy.py
EndpointRetryExhausted
¶
ModelProxy
¶
ModelProxy(model_registry: dict[str, dict[str, Any]], log_file: Path, request_deadline_seconds: float = 900.0, usage_records_file: Path | None = None, allowed_provider_executed_tools: frozenset[str] | set[str] | None = None, budget_exhausted_callback: 'Callable[[str], None] | None' = None)
Loopback-only split proxy for sandboxed harness execution.
A host-side broker forwards requests to the upstream model API while a sandbox-local HTTP proxy serves the harness on sandbox localhost.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_registry
|
dict[str, dict[str, Any]]
|
Mapping of configured model names to upstream connection details |
required |
log_file
|
Path
|
Path to log file for request/response logging |
required |
request_deadline_seconds
|
float
|
Total time budget for one upstream request including retries |
900.0
|
usage_records_file
|
Path | None
|
Optional JSONL file to append per-request usage records to |
None
|
allowed_provider_executed_tools
|
Iterable[str] | None
|
Provider-executed tool types to permit. Empty/None (the default) blocks
all of them: they run on the provider's infrastructure rather than in the
sandbox, so the sandbox network namespace cannot confine them and their
activity is invisible to the harness transcript. See
:data: |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
usage_records |
list[dict[str, Any]]
|
Recorded per-request usage accounting records |
Examples:
>>> registry = {"demo": {"base_url": "https://api.example.com/v1", "api_key": "key", "model": "demo/model"}}
>>> with ModelProxy(registry, Path("proxy.log")) as proxy:
... len(proxy.usage_records)
0
Source code in automaton/proxy.py
find_provider_executed_tools
¶
Return the provider-executed tool types declared in a request body.
Recurses into Responses-API namespace tools, which nest a tools list.
Unknown tool types are reported too: a tool that is neither a recognized
local type nor a known provider type is treated as suspect so that new
provider-side capabilities fail closed rather than passing silently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
Any
|
Parsed JSON request body. Non-dict input yields an empty list. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted, de-duplicated tool types that are not locally executed. |
Examples:
>>> find_provider_executed_tools({"tools": [{"type": "web_search"}]})
['web_search']
>>> find_provider_executed_tools({"tools": [{"type": "function", "name": "ls"}]})
[]