Skip to content

Add explainer for WebMCP continuations. - #327

Open
markafoltz wants to merge 2 commits into
mainfrom
cont-explainer
Open

markafoltz wants to merge 2 commits into
mainfrom
cont-explainer

Conversation

@markafoltz

Copy link
Copy Markdown
Collaborator

Addresses #135

@beaufortfrancois beaufortfrancois left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits

Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated
Comment thread continuations-explainer.md Outdated

@domfarolino domfarolino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, I think we're about done.

@@ -0,0 +1,259 @@
# Continuation Tokens

[*mark a. foltz*](mailto:mfoltz@google.com)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be indented by two characters, not one.

```js
// /billing.html
modelContext.registerTool({
name: "checkout",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probable be indented by two characters, not three.

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.

3 participants