Start from another agent

Every runner is also an MCP server. From any client that speaks the Model Context Protocol, you can start a thread, a factory or a loop on Threadrun without leaving your session, then keep the conversation there: reply to the agent, read its answer and steer it. Work started inside a project runs on that project's repository.

This page shows where to find the address and key, how to add the server to a client, how to talk to a thread from the CLI, and how to install the Threadrun skill that makes the hand-off reliable.

The address and key

Open Settings → Runners, open a runner's Access tab. A runner that is running or installed has a Start work from other agents section with:

  • MCP URL: the address a client connects to.
  • MCP key: a key derived from the runner's access token. It can start work, reply to it and read it, but it can't change the runner's settings, policy or team. It stays the same across restarts.

On this computer the address is:

http://127.0.0.1:8787/agent/mcp

On a server, use the HTTPS address the card shows when phone access is on. With phone access off, the runner listens only on the server's loopback address: forward it from a terminal on your computer and use the same local address.

ssh -N -L 8787:127.0.0.1:8787 you@your-server

Keep that command running while the other agent uses Threadrun.

The key is a credential. Anyone who has it can start agents on the runner and spend your model budget. Treat it like an API key: don't commit it, and keep it out of project files that are shared.

Add the server

Add a remote MCP server to your client, using the URL and key from the runner's card:

  • Transport: streamable HTTP
  • URL: the MCP URL from the card, such as https://178-62-201-159.nip.io/agent/mcp
  • Header: Authorization: Bearer <key>

A client that takes a JSON entry accepts this shape (the field names depend on the client):

{
  "type": "remote",
  "url": "https://178-62-201-159.nip.io/agent/mcp",
  "headers": { "Authorization": "Bearer trmcp_…" }
}

A client with an add command takes the same URL and header. Check the client's server list before asking for work, and keep the entry in the project you want the work to run on when the client stores servers per project.

Keep talking in the CLI

The first request starts the thread. To read the first answer, call read_thread with the thread id, after: 0 and wait_seconds; it returns the conversation when the turn ends. To continue it, the client calls reply with the thread id and the next message. reply waits for the agent's turn to end and returns the conversation, so the CLI can show the answer and take the next instruction:

{
  "thread": "t-1a1c455e64b",
  "complete": true,
  "state": "Idle",
  "messages": [
    { "role": "you", "text": "Also handle empty text." },
    { "role": "agent", "text": "Done: readingTime(\"\") returns 0, with a test. Tests still pass." },
    { "role": "turn", "text": "done" }
  ],
  "next": 42
}
  • **messages** is only the conversation: you, agent, error, approval, permission and turn. Tool calls and logs stay out; thread_status has those.
  • **complete: false** means the turn was still running after wait_seconds (default 30, at most 120). Call read_thread with after set to next and a new wait_seconds for the rest.
  • **waiting_for: "approval" or "permission"** means a person must answer in Threadrun or its web app. Answering there lets the turn continue; reply then reports the rest.
  • **read_thread** with after: 0 shows the latest conversation. With after: next it shows only what came later, and with wait_seconds it waits for the agent before answering.

Use send_prompt instead of reply when the work is long and you don't want to hold the CLI: it sends and returns at once, and read_thread reads progress when the user asks.

After the first request, ask the client to reply on the thread id it reported; the conversation stays in that thread.

Which project the work runs on

A client can't see your project through MCP. To make the hand-off inherit the project, the agent passes the repository with the call. The Threadrun skill tells it to run git remote get-url origin in the current project and pass the result as repo. Threadrun then gives the agents their own clone of that repository on the runner.

  • https://github.com/owner/repo.git and owner/repo both work.
  • A local checkout path also works when it is on the runner itself: Threadrun reads its origin remote.
  • Without repo, the work has no repository. That is only right when the task doesn't touch code.

If your client can't use skills, you can set the project once in the server URL instead:

http://127.0.0.1:8787/agent/mcp?repo=owner/repo

harness=codex (or opencode, gemini, pi, omp, vibe) sets the default agent for that entry too.

Install the Threadrun skill

The skill is a short instruction file. It tells an agent when to use Threadrun, to pass the project's Git remote, how to shape a factory, how to keep the conversation going with reply and read_thread, and to stop at a pending approval instead of polling.

The skill is published for skills.sh, the open Agent Skills directory, so its CLI installs it and keeps it updated:

npx skills add https://threadrun.dev --skill threadrun

It asks which agents to install for. Add -g to make it available in every project.

Without skills.sh, download the same file and save it as SKILL.md in the folder your agent searches for skills:

ClientFolder
OpenCode~/.config/opencode/skills/threadrun/SKILL.md
Claude Code~/.claude/skills/threadrun/SKILL.md
Codex~/.codex/skills/threadrun/SKILL.md

Some clients also read a project's own skills folder, such as .opencode/skills/threadrun/SKILL.md; a project skill works too. The skill only governs when the model should call the MCP tools; the tools work without it.

The tools

ToolWhat it does
runner_infoThe runner's name, version, location, agents and how many are working.
list_threadsThreads and factory runs, newest first, optionally by state.
start_threadOne agent in its own sandbox and branch: prompt, repo, and optional harness, model, effort, mode.
replySend a prompt and wait for the agent's answer; returns the conversation and the next cursor.
read_threadThe conversation without tool noise, optionally waiting for the turn to finish.
send_promptSend a prompt without waiting, for long work; read progress with read_thread.
thread_statusA thread's or run's state, cost, tokens and latest events, including tools.
cancel_threadStop the agent working in a thread.
start_factoryA run of stages, with goal, repo, optional stages, limits and approval gates.
list_loopsSaved loops with their triggers and recent runs.
run_loopStart a saved loop now, by name or id.
create_loopSave a loop (interval, cron, webhook or manual), optionally starting it now.
memory_writeRemember a durable fact about you (a preference, a person, a project, a decision), with the conversation it came from.
memory_searchRecall remembered facts by keyword and recency.
memory_deleteForget a fact by its id.

Agents working in a thread also get two per-thread servers: threadrun-memory with the three memory tools, and threadrun-threads with convert_thread_to_loop (below).

A factory stage is an object with name, instructions, and optionally harness, model, effort, after, approval and spawn. Without stages, one agent does the goal.

Remember and recall

A runner keeps a small long-term memory of facts an agent writes with memory_write, each with the conversation it came from and a timestamp. memory_search returns the ones matching every keyword, newest first, so a client can recall what you told it before instead of asking again. The text is encrypted at rest with the runner's storage key, so it stays on your runner; memory_delete forgets a fact when you ask.

Agents working in a thread also get memory_write, memory_search and memory_delete from threadrun-memory; the server fills in the thread as the source. When you ask one to remember something, it writes a fact to the runner's memory instead of adding a line to the project's AGENTS.md. It is told to ask first when it isn't clear whether you mean a project instruction or a fact about you.

Turn a thread into a loop

Agents working in a thread get convert_thread_to_loop from a second server, threadrun-threads, apart from the memory tools. Ask an agent to turn the conversation into recurring work ("convert this thread to a loop", "run this every morning") and it saves a loop with this thread's repository, agent and options, on the schedule you name. The loop runs as an ordinary factory run, so approvals, budgets and the audit log apply.

The tool only exists inside a thread; a client calling the runner's MCP server from outside uses create_loop instead. See Loops.

See and forget what agents remember

Open Memory in the app's sidebar. It lists every fact, newest first, with the conversation it came from. Only an admin sees it.

  • Type in Search facts and conversations to filter the list.
  • Click a conversation under a fact to open it.
  • Forget removes a fact after you confirm; agents won't recall it again.
  • Refresh picks up facts written since the page opened.

A thread's own memory is its conversation, shown in the thread; its context meter says how full it is. See Threads.

What stays true

  • Same isolation, governance and budgets. Work started from another agent is a normal thread or run: its own container, clone and branch, the runner's policy, approval gates, spend limits and the hash-chained history.
  • Approvals wait for a person. A stage with an approval gate, or an agent asking for permission, waits until someone answers in Threadrun or its web app. reply returns waiting_for instead of waiting silently, and thread_status shows the details.
  • The key can't administer the runner. Changing the policy, team, logins or settings still needs the app or the runner's admin token.
  • Costs are the same. You pay your model provider and your server provider directly. A loop's caps apply to runs started through MCP too.

Troubleshooting

  • 401 Unauthorized: the header isn't Authorization: Bearer <key>, or the runner's token changed. Copy the key from the card again.
  • Connection refused on a server: phone access is off and the SSH forward isn't running, or it points at another machine.
  • **reply returns complete: false:** the turn is still running. Call read_thread with after = next and wait_seconds, or use send_prompt and read later. Nothing is lost; the agent keeps working on the runner.
  • **The client times out during reply:** lower wait_seconds for that client, or configure a longer tool timeout. The turn continues on the runner either way.
  • "This is too big": nothing to do with MCP; that message is the desktop app's.
  • The agent starts work on the wrong repository: install the skill, or put ?repo=owner/repo in the server URL, and tell the agent which project the task is for.