Skip to content

Commit c7f503a

Browse files
authored
Merge branch 'main' into refactor/restructure-mcp-tools-fetching
2 parents d4c24cc + 0858c98 commit c7f503a

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.changeset/big-horses-itch.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@openai/agents-extensions': patch
3+
---
4+
5+
fix: the aisdk extension should grab output when toolCalls is a blank array
6+
7+
When the output of a provider includes an empty tool calls array, we'd mistakenly skip over the text result. This patch checks for that condition.

.changeset/free-jokes-walk.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@openai/agents-core': patch
3+
---
4+
5+
fix: prevent crash when importing in cloudflare workers
6+
7+
An export was missed in https://github.com/openai/openai-agents-js/pull/290 for the workerd shim, this prevents the crash when importing there. Long term we should just add an implementation for cloudflare workers (and I suspect the node implementation might just work)

packages/agents-core/src/shims/shims-workerd.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export function isTracingLoopRunningByDefault(): boolean {
5454
/**
5555
* Right now Cloudflare Workers does not support MCP
5656
*/
57-
export { MCPServerStdio, MCPServerStreamableHttp } from './mcp-server/browser';
57+
export {
58+
MCPServerStdio,
59+
MCPServerStreamableHttp,
60+
MCPServerSSE,
61+
} from './mcp-server/browser';
5862

5963
export { clearTimeout, setTimeout } from 'node:timers';
6064

packages/agents-extensions/src/aiSdk.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ export class AiSdkModel implements Model {
463463
// Putting a text message here will let the agent loop to complete,
464464
// so adding this item only when the tool calls are empty.
465465
// Note that the same support is not available for streaming mode.
466-
if (!result.toolCalls && result.text) {
466+
if (
467+
(!result.toolCalls || result.toolCalls.length === 0) &&
468+
result.text
469+
) {
467470
output.push({
468471
type: 'message',
469472
content: [{ type: 'output_text', text: result.text }],

0 commit comments

Comments
 (0)