Skip to content

Tool call errors have a different trace than tool call errors #17108

Description

@AbhiPrasad

TraceIssue

Repro:

import "./instrument";
import { generateText, streamText, tool } from "ai";
import { openai } from "@ai-sdk/openai";
import dotenv from "dotenv";
import { z } from "zod";
import * as Sentry from "@sentry/node";

dotenv.config();

async function main() {
  const result = await generateText({
    model: openai("o1", { structuredOutputs: true }),
    experimental_telemetry: {
      functionId: "Simple Agent",
      recordInputs: true,
      recordOutputs: true,
      isEnabled: true,
    },
    tools: {
      calculateTool: tool({
        description: `Calculate the result of a math problem. Returns a number.`,

        parameters: z.object({
          a: z.number().describe("First number"),
          b: z.number().describe("Second number"),
        }),
        type: "function",
        execute: async ({ a, b }) => {
          throw new Error("Not implemented");
          return a + b;
        },
      }),
    },
    maxSteps: 2,
    system: `You helps users with their math problems.`,
    prompt: "What is 1 + 1?",
  });
  console.log("result", result.text);
}

main();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

javascriptPull requests that update javascript code

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions