Add explainer for WebMCP continuations. - #327
markafoltz wants to merge 2 commits into
Conversation
domfarolino
left a comment
There was a problem hiding this comment.
Almost there, I think we're about done.
| @@ -0,0 +1,259 @@ | |||
| # Continuation Tokens | |||
|
|
|||
| [*mark a. foltz*](mailto:mfoltz@google.com) | |||
There was a problem hiding this comment.
Call me vain, but feel free to add "with some design input from, domfarolino@gmail.com" if you feel up for it!
| * Calls to resumeTool() while the initial tool is executing are allowed, but any | ||
| invocation of the callback will occur after the initial tool call is complete. | ||
| * Redemption fails if the document is not same-origin and part of the same | ||
| browsing context. same browsing context group. |
There was a problem hiding this comment.
Looks like a small type duplicate
| * Redemption fails if the document is not same-origin and part of the same | ||
| browsing context. same browsing context group. | ||
| * If the original tool call is canceled by the caller (via AbortSignal for | ||
| web-platform callers, or internally by a built-in agent)`,`then the token is |
There was a problem hiding this comment.
comma seems oddly wrapped?
| trajectory data, and will probably fall around 60 seconds. | ||
| * The token is implicitly canceled by the browser if the agent abandoned the | ||
| task, received different user instructions, was blocked from accessing the | ||
| site, etc. |
There was a problem hiding this comment.
Initially I was a little worried about how we'll find the best way to word this/these conditions in the spec, and how they relate to the timeout. But thinking through it more, I guess it's not too hard. As long as the platform side of the bargain is upheld (satisfying the timeout, and browsing context group / origin conditions) AND the agent has not signaled tool call abandonment to the user, then token redemption is invalid. Not too bad.
| task, received different user instructions, was blocked from accessing the | ||
| site, etc. | ||
|
|
||
| If any of these conditions are not met, then `resumeTool()` rejects. |
There was a problem hiding this comment.
Let's maybe also add a note saying that if the agent rejects the tool after the continuation is resumed, then this will be signaled through the ModelContextExecuteToolOptions that will be passed into the resumption callback, just as it was passed into the original callback.
| When the tool requests a token, this is a signal to the agent that the tool has | ||
| not completed execution. Any output from the tool should be considered as | ||
| partial output, and the browser should expect additional output before the tool | ||
| invocation is completed. |
There was a problem hiding this comment.
I don't love the "partial output" framing, since I'm not sure it's our plan to use continuation output as a "stream of intermediate data" to the agent. At least that's what I vaguely remember us settling on partial output / streaming as a separate proposal?
| }, required: ["billing_address", "shipping_address"] | ||
| }, | ||
| execute: async (input, options) => { | ||
| // We'll need to continue on the next page for billing info. |
There was a problem hiding this comment.
These should be indented by two characters, not one.
| ```js | ||
| // /billing.html | ||
| modelContext.registerTool({ | ||
| name: "checkout", |
There was a problem hiding this comment.
This should probable be indented by two characters, not three.
Addresses #135