Agents
Scripts and HTTP
Use any program or web service as an agent, with the Process and HTTP adapters.
These two adapters let an agent be your own code. Neither needs a vendor tool. Both have run only against a test agent and a test server on one machine.
Process: a program or script
Choose Process as the Adapter. Its settings are Command, which is required, and Environment.
zerohead runs the command once for each run.
- The command takes no arguments. Wrap arguments in a script.
- The prompt, with the agent's added instructions, arrives on standard input.
- The working folder is the run's folder.
- Each line the program prints is logged. Lines on standard error are logged too.
- Exit code 0 is a success. The last non-empty line it printed is the run's result. Any other exit code is a failure.
The program starts with these environment variables:
| Variable | Value |
|---|---|
ZEROHEAD_RUN_ID | The run's ID. |
ZEROHEAD_AGENT_ID | The agent's ID. |
ZEROHEAD_TASK_ID | The task's ID. Set only when the run has a task. |
ZEROHEAD_MCP_URL | The address of zerohead's tool endpoint. |
ZEROHEAD_MCP_TOKEN_FILE | A private file holding the run's token. It is removed before the run ends. |
To use zerohead's tools, send JSON-RPC 2.0 requests with POST to ZEROHEAD_MCP_URL. Put the token from the file in an Authorization: Bearer header. The endpoint answers initialize, ping, tools/list and tools/call, and keeps no session. The token works only while the run lasts.
HTTP: a web service
Choose HTTP as the Adapter. Its settings are Address, which is required, and Headers. The address is shown on every paired device and is not a secret. Put keys in Headers, not in the address. An address with a user name or password is refused.
For each run zerohead sends one JSON POST to the address. The body holds run_id, agent_id, prompt, system_append, cwd, task_id when the run has a task, and mcp, the tool endpoint's address and token.
- A 2xx reply is a success. The result is the JSON
resultfield when it is a string, or the raw text. The reply may be up to 1 MiB. - Anything else fails the run: a redirect, another status, a longer reply or a transport error.
- zerohead never follows redirects and never uses a proxy from your environment.
- The tool token is sent only to an
httpsaddress or to this computer. For any otherhttpaddress the run still happens, without the token, and the log shows a warning.
If you can reach your service only through a proxy, you cannot use this adapter yet.
A script or service runs with your user's permissions and zerohead adds no sandbox around it. Run only code you trust.
Timeouts and cancel
A timeout or cancel stops the program and its child processes, or aborts the request in flight. The run still ends with one result.