Repository navigation
Conversation
🦋 Changeset detectedLatest commit: a4e28b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
ben-reitz
force-pushed
the
browser/exec-tool-metadata
branch
from
November 3, 2026 10:14
352353b to
8692445
Compare
ben-reitz
marked this pull request as ready for review
November 3, 2026 10:25
ben-reitz
force-pushed
the
browser/exec-tool-metadata
branch
from
November 3, 2026 11:31
8692445 to
eab3b67
Compare
ben-reitz
force-pushed
the
browser/exec-tool-metadata
branch
from
November 3, 2026 11:50
eab3b67 to
5cff4a5
Compare
aron-cf
reviewed
Nov 3, 2026
| // Inside an agent with one instance per conversation. | ||
| const tools = createAITools({ | ||
| workspace, | ||
| execMetadata: ({ toolCallId }) => ({ conversation: this.name, toolCall: toolCallId }), |
Collaborator
There was a problem hiding this comment.
I think I'd rather this was exec: { metadata: ... }
Contributor
Author
There was a problem hiding this comment.
@aron-cf exec is just used for the backend definitions right now.
createAITools({
workspace,
exec: { javascript: {}, container: { description: "…" } }, // backends, keyed by id
execOutput: { maxBytes, maxLines },
execMetadata: ({ toolCallId }) => ({ … }), // added in this pr
});we could change the api to something like this instead which is a bit nicer than what we have right now?
createAITools({
workspace,
exec: {
backends: { javascript: {}, container: { description: "…" } }, // backends, keyed by id
output: { maxBytes, maxLines },
metadata: ({ toolCallId }) => ({ … }), // added in this pr
}
});
Contributor
Author
There was a problem hiding this comment.
#300 i've opened this in case we want to make this change.
aron-cf
force-pushed
the
browser/exec-tool-metadata
branch
from
November 3, 2026 14:17
5cff4a5 to
88bc6b2
Compare
This was referenced Nov 3, 2026
A run's metadata tells host modules who the run is for, but the exec tool started every run without any, and the AI SDK and TanStack tools passed only the abort signal on, so an app had no way to supply it. `createExecTool` now takes `metadata` and every tool set takes `execMetadata`: a record of strings, or a function that picks one from the tool call's id, which each agent library passes on. A throw from the function fails the call before anything runs. A pi caller runs each call itself, so it can pass `metadata` on the context it hands `execute` instead, and metadata passed with a call wins, since the caller that passed it knows that call best.
ben-reitz
force-pushed
the
browser/exec-tool-metadata
branch
from
November 4, 2026 10:55
88bc6b2 to
a4e28b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The exec tool starts every run without metadata, and the AI SDK and TanStack adapters pass only the abort signal on, so an app using the tool sets has no way to tell host modules who a run is for.
createExecToolnow takesmetadataand every tool set takesexecMetadata: a record of strings, or a function that picks one from the tool call's id, which every agent library passes on. A throw from the function fails the call before anything runs.A pi caller runs each call itself, so it can also pass
metadatawith the call:execute(call, { metadata }). When both are given, metadata passed with the call wins outright and the function isn't called, since the caller that passed it knows that call best.defineExecaccepts either on eachexecute.The function gets only
{ toolCallId }, not each library's whole call. The known callers need a value per call (pi passes it) or per agent (closed over), and the call id covers linking runs to tool calls. Handing over the AI SDK's or TanStack's own call object can be added later without breaking anyone.Tests cover each adapter, a static record, the precedence rule, and a picker that throws.
docs/09_tool_interface.mdhas a new section on run metadata.