-
Notifications
You must be signed in to change notification settings - Fork 285
Open
LuminaX-alt/openai-agents-js
#2Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspackage:agents-extensionsskip-stale
Description
Describe the bug
ModelBehaviorError: Invalid output type when using openrouter with aisdk and outputType
ModelBehaviorError: Invalid output type
at executeToolsAndSideEffects (/Users/rajnandan1/Code/node_modules/@openai/agents-core/src/runImplementation.ts:614:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async <anonymous> (/Users/rajnandan1/Code/node_modules/@openai/agents-core/src/run.ts:408:32)
at async <anonymous> (/Users/rajnandan1/Code/node_modules/@openai/agents-core/src/tracing/context.ts:60:20)
at async <anonymous> (/Users/rajnandan1/Code/aisdk.ts:29:17) {
state: undefined
}
Debug information
- Agents SDK version: (e.g.
v0.0.13
) - Runtime environment (e.g.
Node.js v24.1.0
) - "zod": "^3.25.67",
- "@openrouter/ai-sdk-provider": "^0.7.3",
- "@ai-sdk/openai": "^1.3.23",
- "@openai/agents-extensions": "^0.0.13",
Repro steps
import { Agent } from '@openai/agents';
import { aisdk } from '@openai/agents-extensions';
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
import { Runner } from '@openai/agents';
import { z } from 'zod';
import dotenv from 'dotenv';
dotenv.config();
const StartAgentResponseSchema2 = z.object({
content: z.string().describe('Markdown formatted content ')
});
const modelName = 'anthropic/claude-sonnet-4';
const openrouter = createOpenRouter({
apiKey: process.env.OPEN_ROUTER_KEY || ''
});
const model = aisdk(openrouter(modelName));
const runner = new Runner({
model: model,
tracingDisabled: true
});
const agent = new Agent({
name: 'Assistant',
instructions: 'You are a helpful assistant',
outputType: StartAgentResponseSchema2
});
try {
const result = await runner.run(agent, 'Write a haiku about programming.');
console.log(result.finalOutput);
} catch (e) {
console.log(e);
}
Expected behavior
{
'content': 'Function calls itself \nEndless echoes in the code \nI see me again'
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspackage:agents-extensionsskip-stale