Skip to content

give agents one tool, script, that runs their tools from code - #230

Open
hkonsti wants to merge 5 commits into
mainfrom
hkonsti/agent-sandbox-cli-planning
Open

hkonsti wants to merge 5 commits into
mainfrom
hkonsti/agent-sandbox-cli-planning

Conversation

@hkonsti

@hkonsti hkonsti commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Agents now have one tool, script: a short JavaScript or TypeScript program whose pap functions (startTask, connections, tools, call, finishTask, feedback) replace the seven MCP tools. One model turn can look through several accounts at once with Promise.all, go through what it found in code, and answer with only what it needs, rather than a model call per tool call. Every pap.call still goes through runAgentTool, so access, tasks and the activity log are unchanged; read and run are merged into it.

Scripts run in QuickJS (WebAssembly) in a runner process of its own, started with an empty environment and used for one script; a spare is kept ready, so a script starts in about 15 ms. The api keeps the limits a broken runner can't get around (150 s wall clock, 2 MB output, 200 calls, 8 at once), and the runner the memory, stack and CPU ones. Sucrase strips TypeScript types without moving lines, so errors point at the agent's own line numbers.

Also:

  • The tool is marked read-only: what an agent may do is set in Personal Agent Proxy, per connection, so clients needn't ask before each script.
  • The built-in agent's sub-agents get script too, without starting or finishing tasks, and an interrupted script is never run again, since it may have written something.
  • The pre-task failsafe is removed (clients that old can't call script), and with it runAgentTool's readOnly option; a call of a tool no longer listed is told the tool list changed.
  • The MCP docs page describes script and the pap functions.

After deploy, connected MCP clients need to fetch the tool list again: those that handle list_changed do so on their next call; others need reconnecting.


Open workspace in Conductor

…m code in a QuickJS runner of its own

Agents write a short JavaScript or TypeScript program that calls pap.startTask, pap.connections,
pap.tools, pap.call, pap.finishTask and pap.feedback, so one model turn can look through several
accounts at once and answer with only what it needs. Every call still goes through the gate and
into the activity log. The script runs in QuickJS (WebAssembly) in a process of its own with an
empty environment, with limits on its time, memory, output and calls kept by the api. The MCP
server and the built-in agent's sub-agents both use it; read and run are merged into pap.call,
and the pre-task failsafe is gone.
…c takes a sandbox's id, and that pap.feedback goes in a script

Found running the built-in agent on the demo workspace: both models gave sandbox_exec the name
they had just made a sandbox with, a script running calls at once couldn't tell which one failed,
and a sub-agent called pap.feedback as a tool of its own.
The MCP instructions and script tool, the built-in agent's prompts, tools and log notes, the
script answers, the errors and what pap.tools gives are each about 60% shorter: what a tool
does in detail stays in its own description, which pap.tools gives when it is needed. On the
demo workspace, Claude answered every case as before with 31% fewer input tokens.
An empty answer woken by an event, not by the person, is kept as no words: the page already
shows no answer without them, and the log replays none to the model, which can't send an empty
message. One to the person still says it had nothing to say.
…-cli-planning

# Conflicts:
#	packages/api/src/harness/thread-task.ts

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant