Skip to content

Runners ​

A runner is a small always-on service that turns Truetask work into an AI coding session on a server you run. Truetask calls it at a workflow step's launch URL when that step becomes its agent's turn, or the runner polls for the agent's tasks with the agent's own token. The runner starts a coding CLI such as Claude Code or Codex, and the agent does the task through Truetask MCP as its own bot account.

A runner is plumbing, not a harness. It does not plan, review or retry the work. The workflow contract the agent reads tells it what to do, and people review the result through done proposals.

Truetask's reference runner, truetask-integrations-runner, is one file of Node 20 with no dependencies, meant to be read and adapted. Other runners speak the same contract: a gateway such as Hermes or OpenClaw, a CI job, an n8n workflow.

Launch URLs and webhooks ​

Truetask talks to the outside world about agents over two separate channels, and they do different jobs.

Outbound webhooksLaunch URL
PurposeObservability: tell other systems what happenedDelivery: start the next agent's session on your runner
Set up inWebhooks in Integrations, one subscription eachA workflow step, under Call a launch URL
ReceiversAny numberOne per step
EventsEvery subscribed workspace eventagent_run.handoff, when the step becomes its agent's turn
SignatureX-Truetask-Signature: sha256=... over the bodyX-Webhook-Signature-V2 over <timestamp>.<body>
RetriesDurable queue per deliveryNone: one call, recorded on the run

A webhook fans out to many receivers and never changes what Truetask does next. A launch URL is called once per turn, and when the call fails the run waits for a manual pickup.

A typical setup uses both. The launch URL starts the agent. A webhook subscription on the agent lifecycle events posts progress to chat or a dashboard, and records what happened even while the runner is down.

See Webhooks for the observability side.

Setting one up ​

  1. Create the agent. Add it to the boards it should work. See Creating an agent.
  2. Give it a token. Set up its MCP connection and mint a write token. It belongs to the bot, never to a person. See MCP: connect any AI tool.
  3. Make a signing secret. In a Signing secret picker, such as the one on a workflow step's launch URL, choose New, then Generate, name it and save it. The value is copied for you and never shown again. Over the API it is POST /v1/signing-secrets with a label and a secret of at least 8 characters. Workspace owners and admins make signing secrets.
  4. Point the workflow step at the runner. In the board's agent workflow, give the step this agent, choose Call a launch URL where the step asks how the agent gets started, enter the address the runner listens on as Launch URL, and pick that signing secret.
  5. Fill in the runner's environment and run it. Point the runner's working folder at a plain folder that holds your checkout, not the checkout itself.
  6. Test it. Take a throwaway task through the workflow to that step and watch the runner log. The run log records every call with the status the runner answered.

Verifying a signed call ​

A launch call is a POST with a JSON body. When the step has a signing secret it carries two headers.

text
X-Webhook-Timestamp: <unix seconds>
X-Webhook-Signature-V2: <hex HMAC-SHA256(secret, "<timestamp>.<raw body>")>

The signed string is the timestamp, a dot, and the raw request bytes exactly as received. Verify before you parse the JSON, and compare in constant time.

js
import crypto from 'node:crypto';

function verify_call(secret, timestamp, raw_body, signature, now_s = Math.floor(Date.now() / 1000)) {
	if (!/^\d+$/.test(timestamp ?? '') || !/^[0-9a-f]{64}$/i.test(signature ?? '')) return false;
	if (Math.abs(now_s - Number(timestamp)) > 300) return false;
	const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.`).update(raw_body).digest();
	return crypto.timingSafeEqual(expected, Buffer.from(signature, 'hex'));
}

Reject a timestamp more than 300 seconds away from your clock in either direction, and remember the signatures you accepted inside that window so a captured call cannot be replayed.

A step with no signing secret sends unsigned calls. The reference runner refuses them, and yours should too.

What a runner receives ​

A launch URL receives one event, agent_run.handoff, each time its step becomes its agent's turn: a handoff from the step before, a send-back to that step, a retry or a reassignment.

The payload carries event and event_type with the same value, run_id, card_id (the task), board_id, workflow_id, step with its key, name and position, and from_agent and to_agent, each with an id and a name. The agent whose turn it is, and whose session the runner should start, is to_agent.

The call carries no brief, no secret and no token. The runner reads the task with the agent's own token: cards_context over MCP, or the brief from GET /v1/agent-runs/card/{card_id}/kickoff. GET /v1/webhooks/events on your workspace documents every event's fields.

The answer ​

Answer within 10 seconds with any 2xx status. Truetask records every call on the run: a 2xx as evidence, and anything else, no answer or an unreachable address as a blocker. After a failed call the run waits for a manual pickup, with Copy kickoff as the fallback.

The call is never retried, so answer fast. Acknowledge first and do the work afterwards, never inside the request.

When a step fails ​

A step your runner's agent cannot finish is reported failed with a concrete blocker and, when the job knows it, a failure_kind. The kind decides what happens next.

failure_kindWhat it meansWhat Truetask does
blockedThe agent judged the task cannot be doneNever retried; the run stops and a person decides
tool_errorA tool or an AI provider failedOne retry, then a person is asked and another agent is offered
timeoutThe job ran out of time or budgetOne retry with the instruction to narrow the scope, then a person is asked
unreachableNothing could be reached to do the workNo retry is spent; the run waits and starts again once a computer connects
noneTruetask cannot tellThe workflow step's own failure policy applies

The response's failure_policy says what to do: keep working the same step, go back to an earlier one, or stop. Never orchestrate your own retries after reporting a failure.

CLI forms ​

The reference runner uses only the headless forms Truetask has verified. The prompt always goes on stdin.

sh
claude --print --output-format json [--model <model>] [--permission-mode bypassPermissions]
codex exec --cd <workdir> --ephemeral --output-last-message <file> [--model <model>] [--dangerously-bypass-approvals-and-sandbox] -

For headless authentication, run claude setup-token once interactively as the user that runs the runner and put the printed token in CLAUDE_CODE_OAUTH_TOKEN, or use ANTHROPIC_API_KEY when you pay through the API. For Codex, run codex login once as the runner's user.

MCP registration differs by tool. Claude Code reads .mcp.json in its working folder, with the workspace's /mcp address, the bearer token and the X-Truetask-Tools: task header for the short tool list. Codex registers once with codex mcp add truetask --url "https://<workspace>/mcp?tools=task" --bearer-token-env-var TRUETASK_MCP_TOKEN and reads the token from that variable at run time.

Security ​

Task text is the prompt

Anyone who can edit a task the agent works writes part of its prompt. Spawn the CLI with an argument array and no shell, and put the prompt on stdin only, never in argv.

  • Bypass is opt-in. The CLIs' bypass flags let the agent run commands without asking. Treat that switch as running code for everyone who can edit a task. Run the runner in a container or a VM, as a dedicated OS user with no access to your home folder, SSH keys or cloud credentials, with a working folder that holds nothing but the work.
  • Two secrets, opposite directions. The signing secret proves to the runner that a call came from Truetask. The MCP token proves to Truetask that a call came from the agent. Never reuse one as the other, and keep the signing secret out of the CLI's environment.
  • Least privilege. The MCP token belongs to the agent's bot account, never to a person, and the bot can only reach the boards it is on, at its board role. Keep it on only the boards it should work. The contract has it propose done, and a person approves the work or sends it back; a send-back to the runner's step calls its launch URL again.
  • The token file stays private. For Claude Code the token has to be on disk in .mcp.json. Write it at mode 0600, keep it outside the repository, and never commit it or bake it into an image.
  • Serve it over HTTPS. The signature stops forged calls, but the payload is readable in transit over plain HTTP.

Concurrency ​

Truetask does not cap how many runs an agent has in flight. How many queue tasks start at once is the queue's Sessions at once, and a start outside the queue is sent as soon as it is asked for. So a runner can be handed several tasks for one agent at the same moment, and what it does with them is its own call.

The reference runner runs one job at a time per agent, because its jobs share one working folder, and queues the rest.

Run one runner per agent, each with its own signing secret, token and working folder, rather than pointing several agents at one runner. One runner holds one MCP token, which is one bot identity.

Rotating secrets ​

Truetask signs with one secret at a time, so rotate in two steps. Create the new value as a new signing secret but do not pick it on the workflow step yet. Then put the new value in the runner, restart it, and straight away pick the new signing secret on the step. Between the restart and the switch, launch calls fail with 401 and their runs wait for a manual pickup, so keep the gap short. Finish by deleting the old secret.

MCP tokens overlap, so there is no gap: mint a new one, update the runner, restart it, confirm a job reaches Truetask, then revoke the old token.

Polling for work ​

A runner behind NAT or on a laptop, or one that should also pick up tasks started outside a workflow handoff, can poll instead.

A kickoff assigns the bot to the task whether or not any power delivers it, so the assignment is the signal. List the agent's open tasks with its own token every minute or two, skip the ones with a run in flight or a pending done proposal, fetch the brief from GET /v1/agent-runs/card/{card_id}/kickoff, and run the CLI as above. Polling trades latency for reachability, and the waiting and the retries live in your poller.

Truetask works the same on Truetask Cloud and on your own server. Pages and sections that apply to one model only are labelled. For AI assistants: llms.txt.