-
Notifications
You must be signed in to change notification settings - Fork 160
Avoid attempting to serialize the "tool" during tool call execution #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid attempting to serialize the "tool" during tool call execution #790
Conversation
🦋 Changeset detectedLatest commit: 2e34af0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (21 failed)mongodb (1 failed):
redis (1 failed):
starter (18 failed):
turso (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
|
119e416 to
2e34af0
Compare
e7e9c4f to
c4f8033
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a serialization error that occurs when executing tool calls in DurableAgent where the tool's execute function is marked with 'use step'. The workflow step system attempts to capture and serialize the this context, which fails when this is bound to the tool object containing non-serializable properties like inputSchema.
Changes:
- Modified
executeToolfunction to extract theexecutemethod before calling it, preventingthisbinding to the tool object - Added changeset documenting the fix
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/ai/src/agent/durable-agent.ts | Extracted execute function to avoid this binding during tool execution |
| .changeset/rude-suits-wonder.md | Added changeset for patch version bump |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fixed serialization issue when executing tool calls in
DurableAgent.What changed?
Modified the
executeToolfunction indurable-agent.tsto extract theexecutemethod from the tool object before calling it, rather than invoking it directly on the tool object. This prevents JavaScript from bindingthisto the tool object, which contains non-serializable properties likeinputSchema.How to test?
Test tool execution in workflows where tools have complex properties that can't be serialized. Verify that tool calls complete successfully without serialization errors.
Why make this change?
When a tool's execute function is used as a workflow step (marked with 'use step'), the step system attempts to capture and serialize
this. Since the tool object contains non-serializable properties, this was causing failures. By extracting the execute function before calling it, we avoid the serialization of the entire tool object.