Skip to content

"No existing trace found" when using with AI-SDK in Deno #709

@supreme-gg-gg

Description

@supreme-gg-gg

Describe the bug

I ran into the following issue after switching the agents to use the google Gemini model via Vercel AI-SDK. I tried disabling tracing but it did not help. Interestingly, this only happened on Deno when I switched to npm it worked fine. But since the library says it supports Deno, perhaps I misconfigured something?

Error: No existing trace found
    at withNewSpanContext (file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3_1/dist/tracing/context.mjs:151:15)
    at file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3_1/dist/tracing/createSpans.mjs:6:16
    at AiSdkModel.getResponse (file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-extensions/0.3.3/dist/aiSdk.mjs:482:16)
    at file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3/dist/run.mjs:414:76
    at async executeRun (file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3/dist/run.mjs:270:31)
    at async file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3/dist/tracing/context.mjs:46:24
    at async run (file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/@openai/agents-core/0.3.3/dist/run.mjs:27:16)
    at async file:///Users/.../supabase/functions/ai-ide/test_aisdk.ts:19:18

Everything works fine before I switched to AI-SDK or when I followed the older version of docs to setup model provider for chat completion endpoint here: https://github.com/openai/openai-agents-js/blob/main/examples/model-providers/custom-example-provider.ts

Debug information

  • Agents SDK version: v0.3.3 (latest)
  • AI-SDK Google: 2.0.44
  • Runtime environment:
deno 2.5.6 (stable, release, aarch64-apple-darwin)
v8 14.0.365.5-rusty
typescript 5.9.2

For more info I'm running this using Supabase edge functions runtime locally.

Repro steps

A simple example:

import { Agent, Runner } from "@openai/agents";
import { aisdk } from "@openai/agents-extensions";
import { createGoogleGenerativeAI } from "@ai-sdk/google";

const apiKey = Deno.env.get("GEMINI_API_KEY");
console.log("API Key present:", !!apiKey);
const google = createGoogleGenerativeAI({ apiKey: apiKey });
const model = aisdk(google("gemini-2.5-flash"));

const agent = new Agent({
  name: "Test Agent",
  instructions: "You are a helpful assistant. Just say 'I am working'.",
  model,
});

console.log("Starting agent run...");

try {
  const runner = new Runner({ tracingDisabled: true });
  const result = await runner.run(agent, "Are you working?");
  console.log("Agent Output:", result.finalOutput);
} catch (error) {
  console.error("Agent failed:", error);
}

Expected behavior

This should work without tracing error on Deno. At least if I disabled tracing no tracing related error should occur...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions