From 515fa120b3d9e8033edfaacd8e8714054ec072e2 Mon Sep 17 00:00:00 2001 From: lforst <8118419+lforst@users.noreply.github.com> Date: Mon, 21 Sep 2026 08:20:25 +0000 Subject: [PATCH 1/2] fix: Capture provider managed tool calls and capture right provider when using Vercel AI gateway --- .../ai-sdk-v7-latest.cassette.json | 324 +++- .../__cassettes__/ai-sdk-v7.cassette.json | 323 +++- .../ai-sdk-v7-auto-hook.span-tree.json | 1441 ++++++++++++++++ .../ai-sdk-v7-auto-hook.span-tree.txt | 1407 ++++++++++++++++ .../ai-sdk-v7-explicit.span-tree.json | 1441 ++++++++++++++++ .../ai-sdk-v7-explicit.span-tree.txt | 1407 ++++++++++++++++ .../ai-sdk-v7-latest-auto-hook.span-tree.json | 1455 +++++++++++++++++ .../ai-sdk-v7-latest-auto-hook.span-tree.txt | 1421 ++++++++++++++++ .../ai-sdk-v7-latest-explicit.span-tree.json | 1455 +++++++++++++++++ .../ai-sdk-v7-latest-explicit.span-tree.txt | 1421 ++++++++++++++++ .../ai-sdk-instrumentation/assertions.ts | 54 + .../ai-sdk-instrumentation/scenario.impl.mjs | 27 + .../plugins/ai-sdk-plugin.test.ts | 49 +- .../instrumentation/plugins/ai-sdk-plugin.ts | 5 +- .../plugins/ai-sdk-v7-telemetry.test.ts | 295 ++++ .../vendor-sdk-types/ai-sdk-v7-telemetry.ts | 11 + js/src/wrappers/ai-sdk/telemetry.ts | 84 + 17 files changed, 12596 insertions(+), 24 deletions(-) diff --git a/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7-latest.cassette.json b/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7-latest.cassette.json index 304a94807..04723cc36 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7-latest.cassette.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7-latest.cassette.json @@ -778,7 +778,7 @@ -0.007480621337890625, 0.04766845703125, -0.04901123046875, 0.0227203369140625, -0.0255889892578125, -0.014129638671875, -0.0164337158203125, 0.0095062255859375, 0.01837158203125, - 0.01837158203125, 0.05340576171875, 0.00007402896881103516, + 0.01837158203125, 0.05340576171875, 7.402896881103516e-5, 0.03070068359375, 0.003925323486328125, -0.0161285400390625, -0.00675201416015625, -0.0189666748046875, -0.01511383056640625, -0.0167999267578125, 0.0219573974609375, @@ -1122,7 +1122,7 @@ 0.0257415771484375, 0.0307464599609375, 0.02386474609375, 0.0018949508666992188, -0.01251220703125, -0.010223388671875, -0.035614013671875, 0.0228118896484375, - -0.000028192996978759766, 0.0123138427734375, 0.005126953125, + -2.8192996978759766e-5, 0.0123138427734375, 0.005126953125, -0.010589599609375, 0.00533294677734375, 0.009490966796875, 0.00566864013671875, -0.005893707275390625, 0.01282501220703125, -0.0113372802734375, 0.00579071044921875, @@ -3822,6 +3822,326 @@ "status": 200, "statusText": "OK" } + }, + { + "callIndex": 2, + "id": "92999d796ad4aa08", + "matchKey": "POST api.openai.com/v1/responses", + "recordedAt": "2026-09-19T10:42:23.620Z", + "request": { + "body": { + "kind": "json", + "value": { + "include": ["web_search_call.action.sources"], + "input": [ + { + "content": [ + { + "text": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "input_text" + } + ], + "role": "user" + } + ], + "max_output_tokens": 128, + "model": "gpt-4.1-mini", + "tool_choice": { + "type": "web_search" + }, + "tools": [ + { + "search_context_size": "low", + "type": "web_search" + } + ] + } + }, + "headers": {}, + "method": "POST", + "url": "https://api.openai.com/v1/responses" + }, + "response": { + "body": { + "kind": "json", + "value": { + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1789814543, + "created_at": 1789814542, + "error": null, + "frequency_penalty": 0, + "id": "resp_00a0521d4fe14a67006aae670e008c87d29e915c3cf701a9be", + "incomplete_details": null, + "instructions": null, + "max_output_tokens": 128, + "max_tool_calls": null, + "metadata": {}, + "model": "gpt-4.1-mini-2025-04-14", + "moderation": null, + "object": "response", + "output": [ + { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ], + "type": "search" + }, + "id": "ws_00a0521d4fe14a67006aae670e28f087d28680ae3ce19ef359", + "status": "completed", + "type": "web_search_call" + }, + { + "content": [ + { + "annotations": [], + "logprobs": [], + "text": "https://www.usebraintrust.com/ ", + "type": "output_text" + } + ], + "id": "msg_00a0521d4fe14a67006aae670eec0c87d2b3d2114da66e12d0", + "role": "assistant", + "status": "completed", + "type": "message" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0, + "previous_response_id": null, + "prompt_cache_key": "[REDACTED]", + "prompt_cache_retention": "in_memory", + "reasoning": { + "context": null, + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "auto", + "status": "completed", + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": { + "type": "web_search_preview" + }, + "tool_usage": { + "image_gen": { + "input_tokens": 0, + "input_tokens_details": { + "image_tokens": 0, + "text_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "image_tokens": 0, + "text_tokens": 0 + }, + "total_tokens": 0 + }, + "web_search": { + "num_requests": 1 + } + }, + "tools": [ + { + "return_token_budget": "default", + "search_content_types": ["text"], + "search_context_size": "low", + "type": "web_search", + "user_location": { + "city": null, + "country": "US", + "region": null, + "timezone": null, + "type": "approximate" + } + } + ], + "top_logprobs": 0, + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 8526 + }, + "user": null + } + }, + "headers": { + "access-control-expose-headers": "X-Request-ID, CF-Ray, CF-Ray", + "alt-svc": "h3=\":443\"; ma=86400", + "cf-cache-status": "DYNAMIC", + "cf-ray": "a3d7fbb6e88ba5a9-IAD", + "content-encoding": "gzip", + "content-type": "application/json", + "date": "Sat, 19 Sep 2026 10:42:23 GMT", + "openai-organization": "braintrust-data", + "openai-processing-ms": "1586", + "openai-project": "proj_vsCSXafhhByzWOThMrJcZiw9", + "openai-version": "2020-10-01", + "server": "cloudflare", + "set-cookie": "[REDACTED]", + "strict-transport-security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-request-id": "req_11eb93ead96f494bb6c32ca478a4397c" + }, + "status": 200 + } + }, + { + "callIndex": 3, + "id": "95feeaf13acfdd40", + "matchKey": "POST api.openai.com/v1/responses", + "recordedAt": "2026-09-19T10:42:25.348Z", + "request": { + "body": { + "kind": "json", + "value": { + "include": ["web_search_call.action.sources"], + "input": [ + { + "content": [ + { + "text": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "input_text" + } + ], + "role": "user" + } + ], + "max_output_tokens": 128, + "model": "gpt-4.1-mini", + "stream": true, + "tool_choice": { + "type": "web_search" + }, + "tools": [ + { + "search_context_size": "low", + "type": "web_search" + } + ] + } + }, + "headers": {}, + "method": "POST", + "url": "https://api.openai.com/v1/responses" + }, + "response": { + "body": { + "chunks": [ + "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_07a855cbcb9a45a8006aae670fb64887d2bcb6d26ccc0be048\",\"object\":\"response\",\"created_at\":1789814543,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}", + "event: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_07a855cbcb9a45a8006aae670fb64887d2bcb6d26ccc0be048\",\"object\":\"response\",\"created_at\":1789814543,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}", + "event: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"type\":\"web_search_call\",\"status\":\"in_progress\",\"action\":{\"type\":\"search\"}},\"output_index\":0,\"sequence_number\":2}", + "event: response.web_search_call.in_progress\ndata: {\"type\":\"response.web_search_call.in_progress\",\"item_id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"output_index\":0,\"sequence_number\":3}", + "event: response.web_search_call.searching\ndata: {\"type\":\"response.web_search_call.searching\",\"item_id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"output_index\":0,\"sequence_number\":4}", + "event: response.web_search_call.completed\ndata: {\"type\":\"response.web_search_call.completed\",\"item_id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"output_index\":0,\"sequence_number\":5}", + "event: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"type\":\"web_search_call\",\"status\":\"completed\",\"action\":{\"type\":\"search\",\"queries\":[\"Search the web for the official Braintrust website. Reply with its URL only.\"],\"query\":\"Search the web for the official Braintrust website. Reply with its URL only.\",\"sources\":[{\"type\":\"url\",\"url\":\"https://www.braintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrust.dev/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/about?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/for-talent?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrustgroup.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrustagency.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://ai.engineer/orgs/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrusttutors.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.aiexplore.io/explore/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://builtin.com/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://digitalintelligence.review/company/braintrust?utm_source=openai\"}]}},\"output_index\":0,\"sequence_number\":6}", + "event: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":1,\"sequence_number\":7}", + "event: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":8}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"https\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"dlRv6OpmfZf\",\"output_index\":1,\"sequence_number\":9}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"://\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"hPjm4RNp8xXdW\",\"output_index\":1,\"sequence_number\":10}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"www\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"NrpshVAiqAWmr\",\"output_index\":1,\"sequence_number\":11}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\".use\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"DtlLbbnU7DnI\",\"output_index\":1,\"sequence_number\":12}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"brain\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"Qa42lhZSAyo\",\"output_index\":1,\"sequence_number\":13}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"trust\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"71BrwdapYJX\",\"output_index\":1,\"sequence_number\":14}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\".com\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"ZejWln1xneAv\",\"output_index\":1,\"sequence_number\":15}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"/\",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"grb639zIsUZs2d8\",\"output_index\":1,\"sequence_number\":16}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" \",\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"obfuscation\":\"cQO4X6NgfaZDF2y\",\"output_index\":1,\"sequence_number\":17}", + "event: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"logprobs\":[],\"output_index\":1,\"sequence_number\":18,\"text\":\"https://www.usebraintrust.com/ \"}", + "event: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com/ \"},\"sequence_number\":19}", + "event: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com/ \"}],\"role\":\"assistant\"},\"output_index\":1,\"sequence_number\":20}", + "event: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_07a855cbcb9a45a8006aae670fb64887d2bcb6d26ccc0be048\",\"object\":\"response\",\"created_at\":1789814543,\"status\":\"completed\",\"background\":false,\"completed_at\":1789814545,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[{\"id\":\"ws_07a855cbcb9a45a8006aae670fde3487d29cd0db894715dc0b\",\"type\":\"web_search_call\",\"status\":\"completed\",\"action\":{\"type\":\"search\",\"queries\":[\"Search the web for the official Braintrust website. Reply with its URL only.\"],\"query\":\"Search the web for the official Braintrust website. Reply with its URL only.\",\"sources\":[{\"type\":\"url\",\"url\":\"https://www.braintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrust.dev/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/about?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/for-talent?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrustgroup.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrustagency.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://ai.engineer/orgs/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrusttutors.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.aiexplore.io/explore/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://builtin.com/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://digitalintelligence.review/company/braintrust?utm_source=openai\"}]}},{\"id\":\"msg_07a855cbcb9a45a8006aae6710b68887d2917aac265afe7ee2\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com/ \"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":1}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":8517,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":9,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":8526},\"user\":null,\"metadata\":{}},\"sequence_number\":21}" + ], + "kind": "sse" + }, + "headers": { + "access-control-expose-headers": "X-Request-ID, CF-Ray, CF-Ray", + "alt-svc": "h3=\":443\"; ma=86400", + "cf-cache-status": "DYNAMIC", + "cf-ray": "a3d7fbc1c8aba5a9-IAD", + "content-type": "text/event-stream; charset=utf-8", + "date": "Sat, 19 Sep 2026 10:42:25 GMT", + "openai-organization": "braintrust-data", + "openai-processing-ms": "1605", + "openai-project": "proj_vsCSXafhhByzWOThMrJcZiw9", + "openai-version": "2020-10-01", + "server": "cloudflare", + "set-cookie": "[REDACTED]", + "strict-transport-security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-request-id": "req_574d1e4682494b8280265b43ae73233e" + }, + "status": 200 + } } ], "meta": { diff --git a/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7.cassette.json b/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7.cassette.json index 2736fb648..c28412424 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7.cassette.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__cassettes__/ai-sdk-v7.cassette.json @@ -778,7 +778,7 @@ -0.007480621337890625, 0.04766845703125, -0.04901123046875, 0.0227203369140625, -0.0255889892578125, -0.014129638671875, -0.0164337158203125, 0.0095062255859375, 0.01837158203125, - 0.01837158203125, 0.05340576171875, 0.00007402896881103516, + 0.01837158203125, 0.05340576171875, 7.402896881103516e-5, 0.03070068359375, 0.003925323486328125, -0.0161285400390625, -0.00675201416015625, -0.0189666748046875, -0.01511383056640625, -0.0167999267578125, 0.0219573974609375, @@ -1122,7 +1122,7 @@ 0.0257415771484375, 0.0307464599609375, 0.02386474609375, 0.0018949508666992188, -0.01251220703125, -0.010223388671875, -0.035614013671875, 0.0228118896484375, - -0.000028192996978759766, 0.0123138427734375, 0.005126953125, + -2.8192996978759766e-5, 0.0123138427734375, 0.005126953125, -0.010589599609375, 0.00533294677734375, 0.009490966796875, 0.00566864013671875, -0.005893707275390625, 0.01282501220703125, -0.0113372802734375, 0.00579071044921875, @@ -4770,6 +4770,325 @@ "status": 200, "statusText": "OK" } + }, + { + "callIndex": 2, + "id": "92999d796ad4aa08", + "matchKey": "POST api.openai.com/v1/responses", + "recordedAt": "2026-09-19T10:41:17.673Z", + "request": { + "body": { + "kind": "json", + "value": { + "include": ["web_search_call.action.sources"], + "input": [ + { + "content": [ + { + "text": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "input_text" + } + ], + "role": "user" + } + ], + "max_output_tokens": 128, + "model": "gpt-4.1-mini", + "tool_choice": { + "type": "web_search" + }, + "tools": [ + { + "search_context_size": "low", + "type": "web_search" + } + ] + } + }, + "headers": {}, + "method": "POST", + "url": "https://api.openai.com/v1/responses" + }, + "response": { + "body": { + "kind": "json", + "value": { + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1789814477, + "created_at": 1789814476, + "error": null, + "frequency_penalty": 0, + "id": "resp_0e4192da0d92b826006aae66cc418487d28c4966d861e7de46", + "incomplete_details": null, + "instructions": null, + "max_output_tokens": 128, + "max_tool_calls": null, + "metadata": {}, + "model": "gpt-4.1-mini-2025-04-14", + "moderation": null, + "object": "response", + "output": [ + { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ], + "type": "search" + }, + "id": "ws_0e4192da0d92b826006aae66cc5a2487d28bd0d55136c88b1a", + "status": "completed", + "type": "web_search_call" + }, + { + "content": [ + { + "annotations": [], + "logprobs": [], + "text": "https://www.usebraintrust.com/ ", + "type": "output_text" + } + ], + "id": "msg_0e4192da0d92b826006aae66cd28c087d28ad35ff0e09c9eec", + "role": "assistant", + "status": "completed", + "type": "message" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0, + "previous_response_id": null, + "prompt_cache_key": "[REDACTED]", + "prompt_cache_retention": "in_memory", + "reasoning": { + "context": null, + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "auto", + "status": "completed", + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": { + "type": "web_search_preview" + }, + "tool_usage": { + "image_gen": { + "input_tokens": 0, + "input_tokens_details": { + "image_tokens": 0, + "text_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "image_tokens": 0, + "text_tokens": 0 + }, + "total_tokens": 0 + }, + "web_search": { + "num_requests": 1 + } + }, + "tools": [ + { + "return_token_budget": "default", + "search_content_types": ["text"], + "search_context_size": "low", + "type": "web_search", + "user_location": { + "city": null, + "country": "US", + "region": null, + "timezone": null, + "type": "approximate" + } + } + ], + "top_logprobs": 0, + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 8526 + }, + "user": null + } + }, + "headers": { + "access-control-expose-headers": "X-Request-ID, CF-Ray, CF-Ray", + "alt-svc": "h3=\":443\"; ma=86400", + "cf-cache-status": "DYNAMIC", + "cf-ray": "a3d7fa1c4925da5c-IAD", + "content-encoding": "gzip", + "content-type": "application/json", + "date": "Sat, 19 Sep 2026 10:41:17 GMT", + "openai-organization": "braintrust-data", + "openai-processing-ms": "1392", + "openai-project": "proj_vsCSXafhhByzWOThMrJcZiw9", + "openai-version": "2020-10-01", + "server": "cloudflare", + "set-cookie": "[REDACTED]", + "strict-transport-security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-request-id": "req_b3974cd12c04447a991fe9983a772cf2" + }, + "status": 200 + } + }, + { + "callIndex": 3, + "id": "95feeaf13acfdd40", + "matchKey": "POST api.openai.com/v1/responses", + "recordedAt": "2026-09-19T10:41:19.016Z", + "request": { + "body": { + "kind": "json", + "value": { + "include": ["web_search_call.action.sources"], + "input": [ + { + "content": [ + { + "text": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "input_text" + } + ], + "role": "user" + } + ], + "max_output_tokens": 128, + "model": "gpt-4.1-mini", + "stream": true, + "tool_choice": { + "type": "web_search" + }, + "tools": [ + { + "search_context_size": "low", + "type": "web_search" + } + ] + } + }, + "headers": {}, + "method": "POST", + "url": "https://api.openai.com/v1/responses" + }, + "response": { + "body": { + "chunks": [ + "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_08a4298104d74b61006aae66cdc18487d2810e847777b6d030\",\"object\":\"response\",\"created_at\":1789814477,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}", + "event: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_08a4298104d74b61006aae66cdc18487d2810e847777b6d030\",\"object\":\"response\",\"created_at\":1789814477,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}", + "event: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"type\":\"web_search_call\",\"status\":\"in_progress\",\"action\":{\"type\":\"search\"}},\"output_index\":0,\"sequence_number\":2}", + "event: response.web_search_call.in_progress\ndata: {\"type\":\"response.web_search_call.in_progress\",\"item_id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"output_index\":0,\"sequence_number\":3}", + "event: response.web_search_call.searching\ndata: {\"type\":\"response.web_search_call.searching\",\"item_id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"output_index\":0,\"sequence_number\":4}", + "event: response.web_search_call.completed\ndata: {\"type\":\"response.web_search_call.completed\",\"item_id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"output_index\":0,\"sequence_number\":5}", + "event: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"type\":\"web_search_call\",\"status\":\"completed\",\"action\":{\"type\":\"search\",\"queries\":[\"Search the web for the official Braintrust website. Reply with its URL only.\"],\"query\":\"Search the web for the official Braintrust website. Reply with its URL only.\",\"sources\":[{\"type\":\"url\",\"url\":\"https://www.braintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrust.dev/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/about?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrustgroup.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrustagency.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://ai.engineer/orgs/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrusttutors.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.aiexplore.io/explore/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://builtin.com/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://digitalintelligence.review/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://enterpriseleague.com/company/braintrust?utm_source=openai\"}]}},\"output_index\":0,\"sequence_number\":6}", + "event: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":1,\"sequence_number\":7}", + "event: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":8}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"https\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"meewrdiDoOn\",\"output_index\":1,\"sequence_number\":9}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"://\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"kx4AfkFT8O6LL\",\"output_index\":1,\"sequence_number\":10}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"www\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"THdoNkWN6d0Os\",\"output_index\":1,\"sequence_number\":11}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\".use\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"Nx1Lwz0590zq\",\"output_index\":1,\"sequence_number\":12}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"brain\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"ktm0sXLSXpa\",\"output_index\":1,\"sequence_number\":13}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"trust\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"XtWLaxnoOEU\",\"output_index\":1,\"sequence_number\":14}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\".com\",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"wCAyaIBQxnSZ\",\"output_index\":1,\"sequence_number\":15}", + "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" \",\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"obfuscation\":\"i1myAu8eGEzdCmk\",\"output_index\":1,\"sequence_number\":16}", + "event: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"logprobs\":[],\"output_index\":1,\"sequence_number\":17,\"text\":\"https://www.usebraintrust.com \"}", + "event: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com \"},\"sequence_number\":18}", + "event: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com \"}],\"role\":\"assistant\"},\"output_index\":1,\"sequence_number\":19}", + "event: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_08a4298104d74b61006aae66cdc18487d2810e847777b6d030\",\"object\":\"response\",\"created_at\":1789814477,\"status\":\"completed\",\"background\":false,\"completed_at\":1789814478,\"error\":null,\"frequency_penalty\":0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":128,\"max_tool_calls\":null,\"model\":\"gpt-4.1-mini-2025-04-14\",\"moderation\":null,\"output\":[{\"id\":\"ws_08a4298104d74b61006aae66cdfb2c87d2b08a986bfcfaeffd\",\"type\":\"web_search_call\",\"status\":\"completed\",\"action\":{\"type\":\"search\",\"queries\":[\"Search the web for the official Braintrust website. Reply with its URL only.\"],\"query\":\"Search the web for the official Braintrust website. Reply with its URL only.\",\"sources\":[{\"type\":\"url\",\"url\":\"https://www.braintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrust.dev/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.usebraintrust.com/about?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.braintrustgroup.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrustagency.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://ai.engineer/orgs/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://braintrusttutors.com/?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://www.aiexplore.io/explore/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://builtin.com/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://digitalintelligence.review/company/braintrust?utm_source=openai\"},{\"type\":\"url\",\"url\":\"https://enterpriseleague.com/company/braintrust?utm_source=openai\"}]}},{\"id\":\"msg_08a4298104d74b61006aae66ce8d6887d2b0cb0c9dbcfb9823\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"https://www.usebraintrust.com \"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":{\"type\":\"web_search_preview\"},\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":1}},\"tools\":[{\"type\":\"web_search\",\"return_token_budget\":\"default\",\"search_content_types\":[\"text\"],\"search_context_size\":\"low\",\"user_location\":{\"type\":\"approximate\",\"city\":null,\"country\":\"US\",\"region\":null,\"timezone\":null}}],\"top_logprobs\":0,\"top_p\":1,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":8517,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":8,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":8525},\"user\":null,\"metadata\":{}},\"sequence_number\":20}" + ], + "kind": "sse" + }, + "headers": { + "access-control-expose-headers": "X-Request-ID, CF-Ray, CF-Ray", + "alt-svc": "h3=\":443\"; ma=86400", + "cf-cache-status": "DYNAMIC", + "cf-ray": "a3d7fa259b92da5c-IAD", + "content-type": "text/event-stream; charset=utf-8", + "date": "Sat, 19 Sep 2026 10:41:18 GMT", + "openai-organization": "braintrust-data", + "openai-processing-ms": "1237", + "openai-project": "proj_vsCSXafhhByzWOThMrJcZiw9", + "openai-version": "2020-10-01", + "server": "cloudflare", + "set-cookie": "[REDACTED]", + "strict-transport-security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-request-id": "req_2f6c23ddc5514764a5011ad4e024408b" + }, + "status": 200 + } } ], "meta": { diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.json b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.json index e039de62b..af9b827b0 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.json @@ -454,6 +454,1447 @@ "testRunId": "" } }, + { + "name": "ai-sdk-provider-tool-generateText-operation", + "children": [ + { + "name": "generateText", + "type": "function", + "children": [ + { + "name": "doGenerate", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + } + } + ], + "metadata": { + "operation": "provider-tool-generateText", + "testRunId": "" + } + }, + { + "name": "ai-sdk-provider-tool-streamText-operation", + "children": [ + { + "name": "streamText", + "type": "function", + "children": [ + { + "name": "doStream", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 8, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8525 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 8, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8525 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 8, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8525 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "totalTokens": 8525 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "totalTokens": 8525 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "time_to_first_token": 0 + } + } + ], + "metadata": { + "operation": "provider-tool-streamText", + "testRunId": "" + } + }, { "name": "ai-sdk-evaluate-operation", "children": [ diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.txt b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.txt index 444e052df..0e2905a27 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.txt +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-auto-hook.span-tree.txt @@ -431,6 +431,1413 @@ span_tree: │ "reasoning_tokens": 0, │ "tokens": 21 │ } + ├── ai-sdk-provider-tool-generateText-operation + │ metadata: { + │ "operation": "provider-tool-generateText", + │ "testRunId": "" + │ } + │ └── generateText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ ├── doGenerate [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } + ├── ai-sdk-provider-tool-streamText-operation + │ metadata: { + │ "operation": "provider-tool-streamText", + │ "testRunId": "" + │ } + │ └── streamText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 8, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8525 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "totalTokens": 8525 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "totalTokens": 8525 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ metrics: { + │ "time_to_first_token": 0 + │ } + │ ├── doStream [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 8 + │ │ }, + │ │ "outputTokens": 8, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 8, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8525 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 8, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8525 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } ├── ai-sdk-evaluate-operation │ metadata: { │ "operation": "evaluate", diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.json b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.json index cc68a3db5..0cdad11a1 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.json @@ -454,6 +454,1447 @@ "testRunId": "" } }, + { + "name": "ai-sdk-provider-tool-generateText-operation", + "children": [ + { + "name": "generateText", + "type": "function", + "children": [ + { + "name": "doGenerate", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + } + } + ], + "metadata": { + "operation": "provider-tool-generateText", + "testRunId": "" + } + }, + { + "name": "ai-sdk-provider-tool-streamText-operation", + "children": [ + { + "name": "streamText", + "type": "function", + "children": [ + { + "name": "doStream", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 8, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8525 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 8, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8525 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 8, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8525 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "totalTokens": 8525 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 8 + }, + "outputTokens": 8, + "totalTokens": 8525 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "time_to_first_token": 0 + } + } + ], + "metadata": { + "operation": "provider-tool-streamText", + "testRunId": "" + } + }, { "name": "ai-sdk-evaluate-operation", "children": [ diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.txt b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.txt index 63c65dfee..45fd47c40 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.txt +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-explicit.span-tree.txt @@ -431,6 +431,1413 @@ span_tree: │ "reasoning_tokens": 0, │ "tokens": 21 │ } + ├── ai-sdk-provider-tool-generateText-operation + │ metadata: { + │ "operation": "provider-tool-generateText", + │ "testRunId": "" + │ } + │ └── generateText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ ├── doGenerate [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } + ├── ai-sdk-provider-tool-streamText-operation + │ metadata: { + │ "operation": "provider-tool-streamText", + │ "testRunId": "" + │ } + │ └── streamText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 8, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8525 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "totalTokens": 8525 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 8 + │ }, + │ "outputTokens": 8, + │ "totalTokens": 8525 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ metrics: { + │ "time_to_first_token": 0 + │ } + │ ├── doStream [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 8 + │ │ }, + │ │ "outputTokens": 8, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 8, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8525 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 8, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8525 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://enterpriseleague.com/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } ├── ai-sdk-evaluate-operation │ metadata: { │ "operation": "evaluate", diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.json b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.json index fbebfeb5a..562358138 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.json @@ -467,6 +467,1461 @@ "testRunId": "" } }, + { + "name": "ai-sdk-provider-tool-generateText-operation", + "children": [ + { + "name": "generateText", + "type": "function", + "children": [ + { + "name": "doGenerate", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cache_creation_tokens": 0, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + } + } + ], + "metadata": { + "operation": "provider-tool-generateText", + "testRunId": "" + } + }, + { + "name": "ai-sdk-provider-tool-streamText-operation", + "children": [ + { + "name": "streamText", + "type": "function", + "children": [ + { + "name": "doStream", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cache_creation_tokens": 0, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "time_to_first_token": 0 + } + } + ], + "metadata": { + "operation": "provider-tool-streamText", + "testRunId": "" + } + }, { "name": "ai-sdk-evaluate-operation", "children": [ diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.txt b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.txt index 9425a2861..bbfa98cb0 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.txt +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-auto-hook.span-tree.txt @@ -443,6 +443,1427 @@ span_tree: │ "reasoning_tokens": 0, │ "tokens": 21 │ } + ├── ai-sdk-provider-tool-generateText-operation + │ metadata: { + │ "operation": "provider-tool-generateText", + │ "testRunId": "" + │ } + │ └── generateText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cache_write_tokens": 0, + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ ├── doGenerate [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "cacheWriteTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cache_write_tokens": 0, + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cache_creation_tokens": 0, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } + ├── ai-sdk-provider-tool-streamText-operation + │ metadata: { + │ "operation": "provider-tool-streamText", + │ "testRunId": "" + │ } + │ └── streamText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cache_write_tokens": 0, + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ metrics: { + │ "time_to_first_token": 0 + │ } + │ ├── doStream [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "cacheWriteTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cache_write_tokens": 0, + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cache_creation_tokens": 0, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } ├── ai-sdk-evaluate-operation │ metadata: { │ "operation": "evaluate", diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.json b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.json index fbebfeb5a..562358138 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.json +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.json @@ -467,6 +467,1461 @@ "testRunId": "" } }, + { + "name": "ai-sdk-provider-tool-generateText-operation", + "children": [ + { + "name": "generateText", + "type": "function", + "children": [ + { + "name": "doGenerate", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cache_creation_tokens": 0, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + } + } + ], + "metadata": { + "operation": "provider-tool-generateText", + "testRunId": "" + } + }, + { + "name": "ai-sdk-provider-tool-streamText-operation", + "children": [ + { + "name": "streamText", + "type": "function", + "children": [ + { + "name": "doStream", + "type": "llm", + "children": [], + "input": { + "maxOutputTokens": 128, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "tools": [ + { + "args": { + "searchContextSize": "low" + }, + "name": "web_search", + "type": "provider" + } + ] + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + } + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "completion_tokens": 9, + "prompt_cache_creation_tokens": 0, + "prompt_cached_tokens": 0, + "prompt_tokens": 8517, + "tokens": 8526 + } + }, + { + "name": "web_search", + "type": "tool", + "children": [], + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search" + } + } + ], + "input": { + "maxOutputTokens": 128, + "maxRetries": 2, + "messages": [ + { + "content": "Search the web for the official Braintrust website. Reply with its URL only.", + "role": "user" + } + ], + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "toolChoice": { + "toolName": "web_search", + "type": "tool" + }, + "tools": { + "web_search": { + "args": { + "searchContextSize": "low" + }, + "isProviderExecuted": true, + "type": "provider" + } + } + }, + "output": { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "responseMessages": "", + "steps": [ + { + "callId": "", + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerMetadata": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "finishReason": "stop", + "model": { + "modelId": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "providerMetadata": { + "openai": { + "responseId": "", + "serviceTier": "auto" + } + }, + "response": { + "messages": [ + { + "content": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + }, + { + "output": { + "type": "json", + "value": { + "action": { + "queries": "[Object]", + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]", + "[Object]" + ] + } + }, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + }, + { + "providerOptions": { + "openai": { + "itemId": "" + } + }, + "text": "https://www.usebraintrust.com/ ", + "type": "text" + } + ], + "role": "assistant" + } + ], + "modelId": "gpt-4.1-mini-2025-04-14", + "timestamp": "" + }, + "runtimeContext": {}, + "stepNumber": 0, + "toolsContext": {}, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "raw": { + "input_tokens": 8517, + "input_tokens_details": { + "cache_write_tokens": 0, + "cached_tokens": 0 + }, + "output_tokens": 9, + "output_tokens_details": { + "reasoning_tokens": 0 + } + }, + "totalTokens": 8526 + }, + "warnings": [] + } + ], + "text": "https://www.usebraintrust.com/ ", + "toolCalls": [ + { + "input": {}, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-call" + } + ], + "toolResults": [ + { + "input": {}, + "output": { + "action": { + "queries": [ + "Search the web for the official Braintrust website. Reply with its URL only." + ], + "query": "Search the web for the official Braintrust website. Reply with its URL only.", + "type": "search" + }, + "sources": [ + { + "type": "url", + "url": "https://www.braintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrust.dev/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/about?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.braintrustgroup.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrustagency.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://braintrusttutors.com/?utm_source=openai" + }, + { + "type": "url", + "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://builtin.com/company/braintrust?utm_source=openai" + }, + { + "type": "url", + "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + } + ] + }, + "providerExecuted": true, + "toolCallId": "", + "toolName": "web_search", + "type": "tool-result" + } + ], + "totalUsage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "usage": { + "inputTokenDetails": { + "cacheReadTokens": 0, + "cacheWriteTokens": 0, + "noCacheTokens": 8517 + }, + "inputTokens": 8517, + "outputTokenDetails": { + "reasoningTokens": 0, + "textTokens": 9 + }, + "outputTokens": 9, + "totalTokens": 8526 + }, + "warnings": [] + }, + "metadata": { + "braintrust": { + "integration_name": "ai-sdk", + "sdk_language": "typescript" + }, + "model": "gpt-4.1-mini", + "provider": "openai.responses" + }, + "metrics": { + "time_to_first_token": 0 + } + } + ], + "metadata": { + "operation": "provider-tool-streamText", + "testRunId": "" + } + }, { "name": "ai-sdk-evaluate-operation", "children": [ diff --git a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.txt b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.txt index 9425a2861..bbfa98cb0 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.txt +++ b/e2e/scenarios/ai-sdk-instrumentation/__snapshots__/ai-sdk-v7-latest-explicit.span-tree.txt @@ -443,6 +443,1427 @@ span_tree: │ "reasoning_tokens": 0, │ "tokens": 21 │ } + ├── ai-sdk-provider-tool-generateText-operation + │ metadata: { + │ "operation": "provider-tool-generateText", + │ "testRunId": "" + │ } + │ └── generateText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cache_write_tokens": 0, + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ ├── doGenerate [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "cacheWriteTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cache_write_tokens": 0, + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cache_creation_tokens": 0, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } + ├── ai-sdk-provider-tool-streamText-operation + │ metadata: { + │ "operation": "provider-tool-streamText", + │ "testRunId": "" + │ } + │ └── streamText [function] + │ input: { + │ "maxOutputTokens": 128, + │ "maxRetries": 2, + │ "messages": [ + │ { + │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "role": "user" + │ } + │ ], + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "toolChoice": { + │ "toolName": "web_search", + │ "type": "tool" + │ }, + │ "tools": { + │ "web_search": { + │ "args": { + │ "searchContextSize": "low" + │ }, + │ "isProviderExecuted": true, + │ "type": "provider" + │ } + │ } + │ } + │ output: { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "responseMessages": "", + │ "steps": [ + │ { + │ "callId": "", + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerMetadata": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "finishReason": "stop", + │ "model": { + │ "modelId": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ }, + │ "providerMetadata": { + │ "openai": { + │ "responseId": "", + │ "serviceTier": "auto" + │ } + │ }, + │ "response": { + │ "messages": [ + │ { + │ "content": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ }, + │ { + │ "output": { + │ "type": "json", + │ "value": { + │ "action": { + │ "queries": "[Object]", + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]", + │ "[Object]" + │ ] + │ } + │ }, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ }, + │ { + │ "providerOptions": { + │ "openai": { + │ "itemId": "" + │ } + │ }, + │ "text": "https://www.usebraintrust.com/ ", + │ "type": "text" + │ } + │ ], + │ "role": "assistant" + │ } + │ ], + │ "modelId": "gpt-4.1-mini-2025-04-14", + │ "timestamp": "" + │ }, + │ "runtimeContext": {}, + │ "stepNumber": 0, + │ "toolsContext": {}, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "raw": { + │ "input_tokens": 8517, + │ "input_tokens_details": { + │ "cache_write_tokens": 0, + │ "cached_tokens": 0 + │ }, + │ "output_tokens": 9, + │ "output_tokens_details": { + │ "reasoning_tokens": 0 + │ } + │ }, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ ], + │ "text": "https://www.usebraintrust.com/ ", + │ "toolCalls": [ + │ { + │ "input": {}, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-call" + │ } + │ ], + │ "toolResults": [ + │ { + │ "input": {}, + │ "output": { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search", + │ "type": "tool-result" + │ } + │ ], + │ "totalUsage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "usage": { + │ "inputTokenDetails": { + │ "cacheReadTokens": 0, + │ "cacheWriteTokens": 0, + │ "noCacheTokens": 8517 + │ }, + │ "inputTokens": 8517, + │ "outputTokenDetails": { + │ "reasoningTokens": 0, + │ "textTokens": 9 + │ }, + │ "outputTokens": 9, + │ "totalTokens": 8526 + │ }, + │ "warnings": [] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "model": "gpt-4.1-mini", + │ "provider": "openai.responses" + │ } + │ metrics: { + │ "time_to_first_token": 0 + │ } + │ ├── doStream [llm] + │ │ input: { + │ │ "maxOutputTokens": 128, + │ │ "messages": [ + │ │ { + │ │ "content": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "role": "user" + │ │ } + │ │ ], + │ │ "model": { + │ │ "modelId": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ }, + │ │ "tools": [ + │ │ { + │ │ "args": { + │ │ "searchContextSize": "low" + │ │ }, + │ │ "name": "web_search", + │ │ "type": "provider" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "content": [ + │ │ { + │ │ "input": {}, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-call" + │ │ }, + │ │ { + │ │ "input": {}, + │ │ "output": { + │ │ "action": { + │ │ "queries": [ + │ │ "Search the web for the official Braintrust website. Reply with its URL only." + │ │ ], + │ │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ │ "type": "search" + │ │ }, + │ │ "sources": [ + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrustagency.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ │ }, + │ │ { + │ │ "type": "url", + │ │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ │ } + │ │ ] + │ │ }, + │ │ "providerExecuted": true, + │ │ "toolCallId": "", + │ │ "toolName": "web_search", + │ │ "type": "tool-result" + │ │ }, + │ │ { + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "itemId": "" + │ │ } + │ │ }, + │ │ "text": "https://www.usebraintrust.com/ ", + │ │ "type": "text" + │ │ } + │ │ ], + │ │ "finishReason": "stop", + │ │ "providerMetadata": { + │ │ "openai": { + │ │ "responseId": "", + │ │ "serviceTier": "auto" + │ │ } + │ │ }, + │ │ "response": {}, + │ │ "usage": { + │ │ "inputTokenDetails": { + │ │ "cacheReadTokens": 0, + │ │ "cacheWriteTokens": 0, + │ │ "noCacheTokens": 8517 + │ │ }, + │ │ "inputTokens": 8517, + │ │ "outputTokenDetails": { + │ │ "reasoningTokens": 0, + │ │ "textTokens": 9 + │ │ }, + │ │ "outputTokens": 9, + │ │ "raw": { + │ │ "input_tokens": 8517, + │ │ "input_tokens_details": { + │ │ "cache_write_tokens": 0, + │ │ "cached_tokens": 0 + │ │ }, + │ │ "output_tokens": 9, + │ │ "output_tokens_details": { + │ │ "reasoning_tokens": 0 + │ │ } + │ │ }, + │ │ "totalTokens": 8526 + │ │ } + │ │ } + │ │ metadata: { + │ │ "braintrust": { + │ │ "integration_name": "ai-sdk", + │ │ "sdk_language": "typescript" + │ │ }, + │ │ "model": "gpt-4.1-mini", + │ │ "provider": "openai.responses" + │ │ } + │ │ metrics: { + │ │ "completion_tokens": 9, + │ │ "prompt_cache_creation_tokens": 0, + │ │ "prompt_cached_tokens": 0, + │ │ "prompt_tokens": 8517, + │ │ "tokens": 8526 + │ │ } + │ └── web_search [tool] + │ output: { + │ "action": { + │ "queries": [ + │ "Search the web for the official Braintrust website. Reply with its URL only." + │ ], + │ "query": "Search the web for the official Braintrust website. Reply with its URL only.", + │ "type": "search" + │ }, + │ "sources": [ + │ { + │ "type": "url", + │ "url": "https://www.braintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrust.dev/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/about?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.usebraintrust.com/for-talent?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.braintrustgroup.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrustagency.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://ai.engineer/orgs/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://braintrusttutors.com/?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://www.aiexplore.io/explore/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://builtin.com/company/braintrust?utm_source=openai" + │ }, + │ { + │ "type": "url", + │ "url": "https://digitalintelligence.review/company/braintrust?utm_source=openai" + │ } + │ ] + │ } + │ metadata: { + │ "braintrust": { + │ "integration_name": "ai-sdk", + │ "sdk_language": "typescript" + │ }, + │ "providerExecuted": true, + │ "toolCallId": "", + │ "toolName": "web_search" + │ } ├── ai-sdk-evaluate-operation │ metadata: { │ "operation": "evaluate", diff --git a/e2e/scenarios/ai-sdk-instrumentation/assertions.ts b/e2e/scenarios/ai-sdk-instrumentation/assertions.ts index c57d7a915..7aaa0f077 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/assertions.ts +++ b/e2e/scenarios/ai-sdk-instrumentation/assertions.ts @@ -1081,6 +1081,60 @@ export function defineAISDKInstrumentationAssertions(options: { ); } + if (options.sdkMajorVersion >= 7) { + for (const operationName of ["generateText", "streamText"]) { + test( + `captures provider-executed tools in ${operationName}`, + testConfig, + () => { + const operation = findLatestSpan( + events, + `ai-sdk-provider-tool-${operationName}-operation`, + ); + const parent = latestEvent( + findChildSpans(events, operationName, operation?.span.id), + ); + expect(parent).toBeDefined(); + const tools = findChildSpans(events, "web_search", parent?.span.id); + expect(tools).toHaveLength(1); + const tool = tools[0]; + expect(tool.span.type).toBe("tool"); + expect(tool.input).toBeDefined(); + expect(tool.output).toBeDefined(); + expect(tool.row.error).toBeUndefined(); + expect(tool.metadata).toMatchObject({ + providerExecuted: true, + toolCallId: expect.any(String), + }); + expect(collectToolCallNames(parent?.output)).toContain( + "web_search", + ); + expect(collectToolResultNames(parent?.output)).toContain( + "web_search", + ); + expect(parent?.output).toMatchObject({ + steps: expect.arrayContaining([ + expect.objectContaining({ + content: expect.arrayContaining([ + expect.objectContaining({ + type: "tool-call", + toolCallId: tool.metadata?.toolCallId, + input: tool.input, + }), + expect.objectContaining({ + type: "tool-result", + toolCallId: tool.metadata?.toolCallId, + output: tool.output, + }), + ]), + }), + ]), + }); + }, + ); + } + } + test("captures trace for generateText() with tools", testConfig, () => { const root = findLatestSpan(events, ROOT_NAME); const trace = findToolTrace(events); diff --git a/e2e/scenarios/ai-sdk-instrumentation/scenario.impl.mjs b/e2e/scenarios/ai-sdk-instrumentation/scenario.impl.mjs index 6a62291e8..8395bae67 100644 --- a/e2e/scenarios/ai-sdk-instrumentation/scenario.impl.mjs +++ b/e2e/scenarios/ai-sdk-instrumentation/scenario.impl.mjs @@ -564,6 +564,33 @@ async function runAISDKInstrumentationScenario( await runDirectModelCalls(); } + if (sdkMajorVersion >= 7) { + for (const operation of ["generateText", "streamText"]) { + await runOperation( + `ai-sdk-provider-tool-${operation}-operation`, + `provider-tool-${operation}`, + async () => { + const result = await instrumentedAI[operation]({ + model: openai.responses("gpt-4.1-mini"), + prompt: + "Search the web for the official Braintrust website. Reply with its URL only.", + tools: { + web_search: openai.tools.webSearch({ + searchContextSize: "low", + }), + }, + toolChoice: { type: "tool", toolName: "web_search" }, + maxOutputTokens: 128, + }); + if (operation === "streamText") { + for await (const _chunk of result.fullStream) { + } + } + }, + ); + } + } + if (options.supportsEvaluate) { const evaluate = options.evaluate ?? instrumentedAI.experimental_evaluate; diff --git a/js/src/instrumentation/plugins/ai-sdk-plugin.test.ts b/js/src/instrumentation/plugins/ai-sdk-plugin.test.ts index 78da92712..015b3763e 100644 --- a/js/src/instrumentation/plugins/ai-sdk-plugin.test.ts +++ b/js/src/instrumentation/plugins/ai-sdk-plugin.test.ts @@ -32,6 +32,7 @@ import { processAISDKOutput as processAISDKOutputActual, processAISDKGenerateImageOutput, extractTokenMetrics, + serializeModelWithProvider, } from "./ai-sdk-plugin"; import iso from "../../isomorph"; import { serializeAISDKToolsForLogging } from "../../wrappers/ai-sdk/tool-serialization"; @@ -666,6 +667,34 @@ describe("AI SDK utility functions", () => { }); }); + it.each([ + ["openai/gpt-4", "openai", "gpt-4"], + ["anthropic/claude-3", "anthropic", "claude-3"], + ["openai/text-embedding-3-small", "openai", "text-embedding-3-small"], + ])( + "should resolve the gateway provider for %s", + (modelId, provider, model) => { + expect( + serializeModelWithProvider({ modelId, provider: "gateway" }), + ).toEqual({ + model, + provider, + }); + }, + ); + + it.each(["gpt-4", "/gpt-4", "openai/", ""])( + "should retain gateway without a usable provider prefix in %s", + (modelId) => { + expect( + serializeModelWithProvider({ modelId, provider: "gateway" }), + ).toEqual({ + model: modelId, + provider: "gateway", + }); + }, + ); + it("should prefer explicit provider over parsed provider", () => { const result = serializeModelWithProvider({ modelId: "anthropic/claude-3", @@ -678,6 +707,7 @@ describe("AI SDK utility functions", () => { }); it("should handle null/undefined model", () => { + // @ts-expect-error Exercise malformed input outside the declared SDK types. const result1 = serializeModelWithProvider(null); expect(result1).toEqual({ model: undefined, @@ -1883,25 +1913,6 @@ describe("AI SDK utility functions", () => { // Helper functions exported for testing // These would normally be private but we're testing them through the module -function serializeModelWithProvider(model: any): { - model: string; - provider?: string; -} { - const modelId = typeof model === "string" ? model : model?.modelId; - const explicitProvider = - typeof model === "object" ? model?.provider : undefined; - - if (!modelId) { - return { model: modelId, provider: explicitProvider }; - } - - const parsed = parseGatewayModelString(modelId); - return { - model: parsed.model, - provider: explicitProvider || parsed.provider, - }; -} - function parseGatewayModelString(modelString: string): { model: string; provider?: string; diff --git a/js/src/instrumentation/plugins/ai-sdk-plugin.ts b/js/src/instrumentation/plugins/ai-sdk-plugin.ts index f371ee6b7..989216a67 100644 --- a/js/src/instrumentation/plugins/ai-sdk-plugin.ts +++ b/js/src/instrumentation/plugins/ai-sdk-plugin.ts @@ -4354,7 +4354,10 @@ export function serializeModelWithProvider(model: AISDKModel | undefined): { const parsed = parseGatewayModelString(modelId); return { model: parsed.model, - provider: explicitProvider || parsed.provider, + provider: + explicitProvider === "gateway" + ? parsed.provider || explicitProvider + : explicitProvider || parsed.provider, }; } diff --git a/js/src/instrumentation/plugins/ai-sdk-v7-telemetry.test.ts b/js/src/instrumentation/plugins/ai-sdk-v7-telemetry.test.ts index 8741a0e1f..3805b2dd3 100644 --- a/js/src/instrumentation/plugins/ai-sdk-v7-telemetry.test.ts +++ b/js/src/instrumentation/plugins/ai-sdk-v7-telemetry.test.ts @@ -41,6 +41,233 @@ describe("braintrustAISDKTelemetry", () => { _exportsForTestingOnly.clearTestBackgroundLogger(); }); + it.each(["generateText", "streamText"])( + "captures provider tools in %s alongside local tools", + async (operation) => { + const telemetry = braintrustAISDKTelemetry(); + const callId = "provider-tools"; + telemetry.onStart({ callId, operationId: `ai.${operation}` }); + telemetry.onLanguageModelCallStart({ callId }); + const toolCall = { + type: "tool-call", + providerExecuted: true, + toolCallId: "search-1", + toolName: "exa_search", + input: { query: "Braintrust" }, + }; + const content = [ + toolCall, + { ...toolCall, type: "tool-result", output: { results: ["found"] } }, + { + ...toolCall, + providerExecuted: false, + toolCallId: "local-1", + toolName: "local", + }, + null, + { ...toolCall, type: "text" }, + { ...toolCall, toolCallId: 123 }, + ]; + telemetry.onLanguageModelCallEnd({ callId, content }); + telemetry.onLanguageModelCallEnd({ callId, content }); + const localCall = { toolCallId: "local-1", toolName: "local", input: {} }; + telemetry.onToolExecutionStart({ callId, toolCall: localCall }); + telemetry.onToolExecutionEnd({ + callId, + toolCall: localCall, + output: "local result", + }); + telemetry.onEnd({ callId, operationId: `ai.${operation}` }); + telemetry.onLanguageModelCallEnd({ callId, content }); + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + const parent = spans.find( + (span) => span.span_attributes?.name === operation, + ); + const tools = spans.filter( + (span) => span.span_attributes?.type === "tool", + ); + expect(tools).toHaveLength(2); + const search = tools.find( + (span) => span.span_attributes?.name === "exa_search", + ); + expect(search).toMatchObject({ + span_parents: [parent?.span_id], + input: { query: "Braintrust" }, + output: { results: ["found"] }, + metadata: { + toolCallId: "search-1", + toolName: "exa_search", + providerExecuted: true, + }, + metrics: { start: expect.any(Number), end: expect.any(Number) }, + }); + expect(search?.metrics).not.toHaveProperty("duration_ms"); + }, + ); + + it("correlates deferred provider results across overlapping operations", async () => { + const telemetry = braintrustAISDKTelemetry(); + for (const key of ["first", "second"]) { + const event = { callId: "shared", [AI_SDK_V7_OPERATION_KEY]: key }; + telemetry.onStart({ ...event, operationId: "ai.generateText" }); + telemetry.onLanguageModelCallStart(event); + telemetry.onLanguageModelCallEnd({ + ...event, + content: [ + { + type: "tool-call", + providerExecuted: true, + toolCallId: "shared-tool", + toolName: "exa_search", + input: { query: key }, + }, + ], + }); + } + for (const key of ["second", "first"]) { + const event = { callId: "shared", [AI_SDK_V7_OPERATION_KEY]: key }; + telemetry.onLanguageModelCallStart(event); + telemetry.onLanguageModelCallEnd({ + ...event, + content: [ + { + type: "tool-result", + providerExecuted: true, + toolCallId: "shared-tool", + toolName: "exa_search", + output: { result: key }, + }, + ], + }); + telemetry.onEnd({ ...event, operationId: "ai.generateText" }); + } + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + const tools = spans.filter((span) => span.span_attributes?.type === "tool"); + expect(tools).toHaveLength(2); + for (const tool of tools) { + expect(tool.output.result).toBe(tool.input.query); + expect(tool.metrics.end).toEqual(expect.any(Number)); + } + expect(tools[0].span_parents).not.toEqual(tools[1].span_parents); + }); + + it.each(["onEnd", "onAbort", "onError"])( + "closes unresolved provider tools on %s", + async (end) => { + const telemetry = braintrustAISDKTelemetry(); + const callId = "unresolved"; + telemetry.onStart({ callId, operationId: "ai.streamText" }); + telemetry.onLanguageModelCallStart({ callId }); + telemetry.onLanguageModelCallEnd({ + callId, + content: [ + { + type: "tool-call", + providerExecuted: true, + toolCallId: "pending", + toolName: "exa_search", + input: { query: "test" }, + }, + ], + }); + telemetry[end]({ + callId, + operationId: "ai.streamText", + error: new Error("interrupted"), + }); + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + const tool = spans.find((span) => span.span_attributes?.type === "tool"); + expect(tool).toMatchObject({ + input: { query: "test" }, + metrics: { end: expect.any(Number) }, + }); + expect(tool).not.toHaveProperty("output"); + if (end !== "onEnd") expect(tool?.error).toContain("interrupted"); + else expect(tool).not.toHaveProperty("error"); + }, + ); + + it("records provider errors and result-only parts", async () => { + const telemetry = braintrustAISDKTelemetry(); + const callId = "errors"; + telemetry.onStart({ callId, operationId: "ai.generateText" }); + telemetry.onLanguageModelCallStart({ callId }); + telemetry.onLanguageModelCallEnd({ + callId, + content: [ + { + type: "tool-error", + providerExecuted: true, + toolCallId: "failed", + toolName: "exa_search", + error: new Error("search failed"), + }, + { + type: "tool-result", + providerExecuted: true, + toolCallId: "result-only", + toolName: "exa_search", + output: "found", + }, + ], + }); + telemetry.onEnd({ callId, operationId: "ai.generateText" }); + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + const failed = spans.find((span) => span.metadata?.toolCallId === "failed"); + expect(failed?.error).toContain("search failed"); + expect(failed).not.toHaveProperty("output"); + const result = spans.find( + (span) => span.metadata?.toolCallId === "result-only", + ); + expect(result?.output).toBe("found"); + expect(result).not.toHaveProperty("input"); + }); + + it.each(["operation", "model"])( + "honors %s recording settings for provider tools", + async (level) => { + const telemetry = braintrustAISDKTelemetry(); + const callId = "private-tools"; + const privacy = { recordInputs: false, recordOutputs: false }; + telemetry.onStart({ + callId, + operationId: "ai.generateText", + ...(level === "operation" ? privacy : {}), + }); + telemetry.onLanguageModelCallStart({ callId }); + telemetry.onLanguageModelCallEnd({ + callId, + ...(level === "model" ? privacy : {}), + content: [ + { + type: "tool-result", + providerExecuted: true, + toolCallId: "secret", + toolName: "exa_search", + input: "secret input", + output: "secret output", + }, + ], + }); + telemetry.onEnd({ callId, operationId: "ai.generateText" }); + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + const tool = spans.find((span) => span.span_attributes?.type === "tool"); + expect(tool).toBeDefined(); + expect(tool).not.toHaveProperty("input"); + expect(tool).not.toHaveProperty("output"); + }, + ); + it("logs operations from AI SDK v7 end-family callbacks", async () => { const telemetry = braintrustAISDKTelemetry(); @@ -195,6 +422,74 @@ describe("braintrustAISDKTelemetry", () => { ).toMatchObject({ output: [{ index: 0, relevance_score: 0.9 }] }); }); + it.each(["generateText", "streamText"])( + "attributes gateway %s spans to the model provider", + async (operation) => { + const telemetry = braintrustAISDKTelemetry(); + const event = { + callId: "gateway-generation", + provider: "gateway", + modelId: "anthropic/claude-3-haiku", + }; + telemetry.onStart({ ...event, operationId: `ai.${operation}` }); + telemetry.onLanguageModelCallStart(event); + telemetry.onLanguageModelCallEnd({ ...event, text: "OK" }); + telemetry.onEnd({ ...event, operationId: `ai.${operation}`, text: "OK" }); + + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + expect(spans).toHaveLength(2); + for (const name of [ + operation, + operation === "streamText" ? "doStream" : "doGenerate", + ]) { + expect( + spans.find((span) => span.span_attributes?.name === name), + ).toMatchObject({ + metadata: { provider: "anthropic", model: "claude-3-haiku" }, + }); + } + }, + ); + + it("attributes gateway embedding spans to the model provider", async () => { + const telemetry = braintrustAISDKTelemetry(); + const event = { + callId: "gateway-embedding", + provider: "gateway", + modelId: "openai/text-embedding-3-small", + }; + telemetry.onStart({ ...event, operationId: "ai.embed", value: "hello" }); + telemetry.onEmbedStart({ + ...event, + embedCallId: "gateway-embedding-child", + values: ["hello"], + }); + telemetry.onEmbedEnd({ + ...event, + embedCallId: "gateway-embedding-child", + embeddings: [[0.1, 0.2]], + }); + telemetry.onEnd({ + ...event, + operationId: "ai.embed", + embedding: [0.1, 0.2], + }); + + const spans = (await backgroundLogger.drain()) as Array< + Record + >; + expect(spans).toHaveLength(2); + for (const name of ["embed", "doEmbed"]) { + expect( + spans.find((span) => span.span_attributes?.name === name), + ).toMatchObject({ + metadata: { provider: "openai", model: "text-embedding-3-small" }, + }); + } + }); + it("logs a generateText operation and model call", async () => { const telemetry = braintrustAISDKTelemetry(); diff --git a/js/src/vendor-sdk-types/ai-sdk-v7-telemetry.ts b/js/src/vendor-sdk-types/ai-sdk-v7-telemetry.ts index b47ebd43f..bbb922576 100644 --- a/js/src/vendor-sdk-types/ai-sdk-v7-telemetry.ts +++ b/js/src/vendor-sdk-types/ai-sdk-v7-telemetry.ts @@ -47,6 +47,17 @@ export interface AISDKV7LanguageModelCallEndEvent [key: string]: unknown; } +export interface AISDKV7ProviderToolPart { + type: "tool-call" | "tool-result" | "tool-error"; + providerExecuted: true; + toolCallId: string; + toolName: string; + input?: unknown; + output?: unknown; + error?: unknown; + [key: string]: unknown; +} + export interface AISDKV7ObjectStepStartEvent extends AISDKV7TelemetryOptions, AISDKV7ModelInfo { callId: string; diff --git a/js/src/wrappers/ai-sdk/telemetry.ts b/js/src/wrappers/ai-sdk/telemetry.ts index 5bb41f885..faa0143e5 100644 --- a/js/src/wrappers/ai-sdk/telemetry.ts +++ b/js/src/wrappers/ai-sdk/telemetry.ts @@ -31,6 +31,7 @@ import type { import type { AISDKV7LanguageModelCallStartEvent, AISDKV7OperationEvent, + AISDKV7ProviderToolPart, AISDKV7Telemetry, AISDKV7TelemetryOptions, } from "../../vendor-sdk-types/ai-sdk-v7-telemetry"; @@ -52,6 +53,9 @@ type OperationState = { ownsSpan: boolean; span: Span; startTime: number; + providerTools: Map; + recordInputs?: boolean; + recordOutputs?: boolean; }; type CallSpanState = { @@ -130,6 +134,11 @@ export function braintrustAISDKTelemetry(): any { return; } + for (const tool of state.providerTools.values()) { + if (!tool.ended) { + tool.span.end(); + } + } operations.delete(operationKey); const keys = operationKeysByCallId.get(state.callId); if (!keys) { @@ -262,6 +271,16 @@ export function braintrustAISDKTelemetry(): any { }; const closeOpenChildSpans = (operationKey: string, error?: unknown): void => { + for (const tool of operations.get(operationKey)?.providerTools.values() ?? + []) { + if (!tool.ended) { + if (error !== undefined) { + tool.span.log({ error }); + } + tool.span.end(); + tool.ended = true; + } + } const openModelSpans = modelSpans.get(operationKey); if (openModelSpans) { for (const span of openModelSpans) { @@ -499,6 +518,9 @@ export function braintrustAISDKTelemetry(): any { ownsSpan, span, startTime: getCurrentUnixTimestamp(), + providerTools: new Map(), + recordInputs: event.recordInputs, + recordOutputs: event.recordOutputs, }); if (!ownsSpan) { @@ -631,6 +653,68 @@ export function braintrustAISDKTelemetry(): any { if (shouldSkipTelemetryChildren(state)) { return; } + // Provider-executed tools bypass the local execution callbacks. Both + // generateText and streamText expose their normalized parts here. + // Timestamps describe when we observe these parts, not server runtime. + if (state && Array.isArray(event.content)) { + for (const part of event.content) { + if ( + !isObject(part) || + part.providerExecuted !== true || + typeof part.toolCallId !== "string" || + typeof part.toolName !== "string" || + typeof part.type !== "string" || + !["tool-call", "tool-result", "tool-error"].includes(part.type) + ) { + continue; + } + const toolPart = part as AISDKV7ProviderToolPart; + let tool = state.providerTools.get(toolPart.toolCallId); + if (tool?.ended) { + continue; + } + if (!tool) { + tool = { + span: startChildSpan( + state.operationKey, + toolPart.toolName, + SpanTypeAttribute.TOOL, + { + metadata: { + ...createAISDKIntegrationMetadata(), + toolCallId: toolPart.toolCallId, + toolName: toolPart.toolName, + providerExecuted: true, + }, + }, + state.harnessTurnParent, + ), + ended: false, + }; + state.providerTools.set(toolPart.toolCallId, tool); + } + if ( + state.recordInputs !== false && + shouldRecordInputs(event) && + toolPart.input !== undefined + ) { + tool.span.log({ input: toolPart.input }); + } + if (toolPart.type === "tool-call") { + continue; + } + if (toolPart.type === "tool-error") { + tool.span.log({ error: toolPart.error }); + } else if ( + state.recordOutputs !== false && + shouldRecordOutputs(event) + ) { + tool.span.log({ output: toolPart.output }); + } + tool.span.end(); + tool.ended = true; + } + } const span = operationKey ? shiftModelSpan(modelSpans, operationKey) : undefined; From 12b5c8396bdd26a684fae85733494b04261df7d6 Mon Sep 17 00:00:00 2001 From: lforst <8118419+lforst@users.noreply.github.com> Date: Mon, 21 Sep 2026 18:38:29 +0000 Subject: [PATCH 2/2] Update PR #2507 --- .changeset/pi-tool-current-span.md | 2 +- .changeset/social-pumas-smoke.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/social-pumas-smoke.md diff --git a/.changeset/pi-tool-current-span.md b/.changeset/pi-tool-current-span.md index 319c8933c..75141b98b 100644 --- a/.changeset/pi-tool-current-span.md +++ b/.changeset/pi-tool-current-span.md @@ -2,4 +2,4 @@ "braintrust": patch --- -Keep Pi Coding Agent tool spans current during execution so nested spans attach to the tool span. +fix: Keep Pi Coding Agent tool spans current during execution so nested spans attach to the tool span. diff --git a/.changeset/social-pumas-smoke.md b/.changeset/social-pumas-smoke.md new file mode 100644 index 000000000..64331a2fe --- /dev/null +++ b/.changeset/social-pumas-smoke.md @@ -0,0 +1,5 @@ +--- +"braintrust": patch +--- + +fix: Capture provider managed tool calls and capture right provider when using Vercel AI gateway