Add ai.remote and RemoteAgent, for running an agent in a worker #350
[vc]: #GARvbmhL/Mx8BK4NzDi95Z2TGBpjNJ6OImWcudcEEUc=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJhaS1weXRob24iLCJwcm9qZWN0SWQiOiJwcmpfRDg5bUY1TUlndnVuR0UyeVFuZWdQUlM3VnBlMCIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS92ZXJjZWwtbGFicy9haS1weXRob24vMmZHNWs4QXdDdXJ4UEJMaHNCSEdoaVFGTldOaSIsInByZXZpZXdVcmwiOiJhaS1weXRob24tZ2l0LXJlbW90ZS1hZ2VudC5sYWJzLnZlcmNlbC5kZXYiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoiYWktcHl0aG9uLWdpdC1yZW1vdGUtYWdlbnQubGFicy52ZXJjZWwuZGV2In0sInJvb3REaXJlY3RvcnkiOiJkb2NzL2FpLXB5dGhvbiJ9XX0=
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated |
| :--- | :----- | :------ | :------ |
| <a href="https://vercel.com/vercel-labs/ai-python"><sup><img src="https://vercel.com/api/www/avatar?projectId=prj_D89mF5MIgvunGE2yQnegPRS7Vpe0&teamId=team_nO2mCG4W8IxPIeKoSsqwAxxB&s=32" width="16" height="16" align="middle" alt="" /></sup></a> ai-python | !Ready Ready | Preview, v0 | <relative-time datetime="2026-11-17T01:16:42.179Z">Nov 17, 2026 1:16am UTC</relative-time> |
Instead of having two ways to specify remoteness, (remote_tools and worker mode) we could make it so RemoteAgent always runs the loop remote, and normal ai.Agent always runs loop locally; and for the normal agent you can specify at tool definition time, whether you want that tool to run remote or locally.
Module-wise, I think we can make both of these top-level modules, even though they technically aren't AI-only; we have prior art in the form of ai.telemetry.
We can prefix all of them as ai.experimental though.
When an approval is pre\-registered before stream iteration\, RemoteAgent ignores that resolution and waits indefinitely for the already\-answered hook\.
<a href="https://vercel.com/vercel-labs/~/agent/tasks/b4a7274a-895b-42c8-b556-9dd248016784#suggestion-7171a4e842e334a863f49341458f3aae43f8cc6794157300f4f26a3967500c36" rel="noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://vercel.com/vercel-agent-view-suggestion-dark"><source media="(prefers-color-scheme: light)" srcset="https://vercel.com/vercel-agent-view-suggestion-light"><img src="https://vercel.com/vercel-agent-view-suggestion-light" alt="Fix on Vercel" width="127" height="28" /></picture></a>
<!-- VADE-GITHUB-SUGGESTION-ID:7171a4e842e334a863f49341458f3aae43f8cc6794157300f4f26a3967500c36 -->
<!-- OMNIAGENT-REVIEW-LOCATION:src%2Fai%2Fremote%2F__init__.py:162:172 -->
<!-- VADE-RECOMMENDATION: FIX -->
<!-- VADE-OUTCOME: ISSUE_RESOLVED -->
When a RemoteAgent loop or its tools call ai\.current\_agent\(\) in the worker\, the missing execution context raises LookupError instead of returning the running agent\.
<a href="https://vercel.com/vercel-labs/~/agent/tasks/b4a7274a-895b-42c8-b556-9dd248016784#suggestion-ab43c6e85626c1fe5e7e49bdcc3830214a7551998b65372a5701962b7f9e3654" rel="noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://vercel.com/vercel-agent-view-suggestion-dark"><source media="(prefers-color-scheme: light)" srcset="https://vercel.com/vercel-agent-view-suggestion-light"><img src="https://vercel.com/vercel-agent-view-suggestion-light" alt="Fix on Vercel" width="127" height="28" /></picture></a>
<!-- VADE-GITHUB-SUGGESTION-ID:ab43c6e85626c1fe5e7e49bdcc3830214a7551998b65372a5701962b7f9e3654 -->
<!-- OMNIAGENT-REVIEW-LOCATION:src%2Fai%2Fremote%2F__init__.py:108:115 -->
<!-- VADE-RECOMMENDATION: FIX -->
<!-- VADE-OUTCOME: ISSUE_RESOLVED -->
When a SubAgentTool waits for approval\, RemoteAgent skips its wrapped HookEvent\, so resolving the nested hook never unblocks the run\.
<a href="https://vercel.com/vercel-labs/~/agent/tasks/b4a7274a-895b-42c8-b556-9dd248016784#suggestion-2b974a6a686d7747751cc44add3f0d6b872f7b9b37dff73d39987d6a92d41550" rel="noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://vercel.com/vercel-agent-view-suggestion-dark"><source media="(prefers-color-scheme: light)" srcset="https://vercel.com/vercel-agent-view-suggestion-light"><img src="https://vercel.com/vercel-agent-view-suggestion-light" alt="Fix on Vercel" width="127" height="28" /></picture></a>
<!-- VADE-GITHUB-SUGGESTION-ID:2b974a6a686d7747751cc44add3f0d6b872f7b9b37dff73d39987d6a92d41550 -->
<!-- OMNIAGENT-REVIEW-LOCATION:src%2Fai%2Fremote%2F__init__.py:260:263 -->
<!-- VADE-RECOMMENDATION: FIX -->
known issue, will get a follow-up I think
oh, no, known issue for just pure remote tool calls but we ought to make remoteagent work
Resolved in 4fbd2ee\: the hook bridge now consumes pre\-registered resolutions and forwards them to the remote hook\.
<!-- OMNIAGENT-REVIEW-RESOLUTION:7171a4e842e334a863f49341458f3aae43f8cc6794157300f4f26a3967500c36 -->
Resolved in 4fbd2ee\: the remote loop now sets the current agent in the worker\'s execution context\.
<!-- OMNIAGENT-REVIEW-RESOLUTION:ab43c6e85626c1fe5e7e49bdcc3830214a7551998b65372a5701962b7f9e3654 -->
Decided I don't care
msullivan
We add a generic protocol (
ai.remote.Runner) for doing asyncexecution of functions in a remote runner.
ai.remote.RemoteAgentwill offload the entire loop to a remoterunner when one is configured.
The main
ai.Agentcan offload tool calls to a remote runner also,with different values to the
execution_strategytoai.tool:local: always run locally
remote-enabled: use remote if a runner is configured
* remote: always remote, fail otherwise
A remote runner is configured with
ai.remote.use_runner.