Skip to content

fix(llmobs): format AI SDK rich tool results#9399

Draft
BridgeAR wants to merge 3 commits into
masterfrom
BridgeAR/2026-07-16-fix-ai-tool-results
Draft

fix(llmobs): format AI SDK rich tool results#9399
BridgeAR wants to merge 3 commits into
masterfrom
BridgeAR/2026-07-16-fix-ai-tool-results

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Summary

AI SDK multipart and error tool outputs were treated as unparsable. This preserves text, emits metadata-free summaries for rich file and image parts, and keeps malformed or circular telemetry inputs from throwing.

Fixes: #9395

@dd-octo-sts

dd-octo-sts Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 7.48 MB
Deduped: 8.14 MB
No deduping: 8.14 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.2 | 124.41 kB | 440.65 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@pr-commenter

pr-commenter Bot commented Jul 16, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-21 01:30:52

Comparing candidate commit d91d6d8 in PR branch BridgeAR/2026-07-16-fix-ai-tool-results with baseline commit c8e8699 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2321 metrics, 37 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-211.888ms; +204.004ms] or [-7.970%; +7.674%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-238.715ms; +236.240ms] or [-9.351%; +9.254%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-168.824ms; +154.477ms] or [-5.460%; +4.996%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-191.805ms; +204.872ms] or [-6.508%; +6.951%]

scenario:appsec-control-20

  • unstable execution_time [-124720.953µs; +124948.753µs] or [-7.576%; +7.590%]

scenario:appsec-control-24

  • unstable execution_time [-114526.148µs; +114674.814µs] or [-9.216%; +9.228%]

scenario:appsec-control-26

  • unstable execution_time [-123.119ms; +120.580ms] or [-9.953%; +9.748%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-18.107ms; +14.299ms] or [-6.970%; +5.504%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-15.769ms; +12.662ms] or [-6.171%; +4.955%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-1986.122ms; +3192.797ms] or [-23.912%; +38.440%]
  • unstable execution_time [-2002.386ms; +3206.113ms] or [-22.173%; +35.502%]
  • unstable instructions [-17.1G instructions; +27.2G instructions] or [-25.201%; +40.164%]
  • unstable max_rss_usage [-8.165MB; +13.326MB] or [-5.201%; +8.489%]
  • unstable throughput [-848.393op/s; +527.386op/s] or [-23.261%; +14.460%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-2.936s; +5.691s] or [-28.063%; +54.402%]
  • unstable execution_time [-2.887s; +5.721s] or [-25.813%; +51.148%]
  • unstable instructions [-26.2G instructions; +50.7G instructions] or [-29.751%; +57.639%]
  • unstable max_rss_usage [-9.539MB; +18.230MB] or [-5.869%; +11.215%]
  • unstable throughput [-1131.165op/s; +513.821op/s] or [-36.789%; +16.711%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-2697.926ms; +4214.287ms] or [-28.305%; +44.213%]
  • unstable execution_time [-2831.902ms; +4346.768ms] or [-27.620%; +42.395%]
  • unstable instructions [-23.1G instructions; +36.9G instructions] or [-29.057%; +46.391%]
  • unstable max_rss_usage [-8.304MB; +13.237MB] or [-5.202%; +8.292%]
  • unstable throughput [-835.134op/s; +560.646op/s] or [-25.762%; +17.295%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-393.085ms; +350.559ms] or [-8.242%; +7.351%]
  • unstable execution_time [-391.279ms; +355.536ms] or [-8.072%; +7.335%]
  • unstable throughput [-110137.328op/s; +140622.990op/s] or [-6.341%; +8.096%]

scenario:plugin-claude-agent-sdk-delayed-noisy-hook-indexed-26

  • unstable execution_time [-10.688ms; +19.377ms] or [-3.798%; +6.885%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-20

  • unstable max_rss_usage [-19.360MB; +32.135MB] or [-5.168%; +8.578%]

scenario:plugin-graphql-long-with-depth-off-20

  • unstable max_rss_usage [-5.384MB; +11.415MB] or [-4.191%; +8.885%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-25.532MB; +17.377MB] or [-11.518%; +7.839%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-562.525ms; +589.353ms] or [-4.892%; +5.125%]
  • unstable execution_time [-577.184ms; +609.557ms] or [-4.915%; +5.191%]
  • unstable throughput [-3.571op/s; +3.380op/s] or [-5.211%; +4.932%]

scenario:plugin-grpc-mixed-26

  • unstable cpu_user_time [-159.364ms; +268.177ms] or [-4.817%; +8.105%]
  • unstable execution_time [-163.591ms; +266.235ms] or [-4.813%; +7.833%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5363.951KB; +5162.951KB] or [-6.638%; +6.390%]

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 16, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 2 Pipeline jobs failed

All Green | all-green   View in Datadog   GitHub Actions

Platform | integration-guardrails (22.0.0)   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 98.42% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d91d6d8 | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.42%. Comparing base (c8e8699) to head (d91d6d8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9399   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files         938      938           
  Lines      126209   126290   +81     
  Branches    10735    10666   -69     
=======================================
+ Hits       124219   124300   +81     
  Misses       1990     1990           
Flag Coverage Δ
aiguard 57.80% <ø> (-0.03%) ⬇️
aiguard-integration 56.20% <36.53%> (-0.03%) ⬇️
apm-bucket-0 57.65% <ø> (-0.03%) ⬇️
apm-bucket-1 63.72% <ø> (-0.03%) ⬇️
apm-bucket-2 62.74% <ø> (-0.03%) ⬇️
apm-bucket-3 60.10% <ø> (-0.03%) ⬇️
apm-capabilities-tracing 64.18% <36.53%> (-0.03%) ⬇️
apm-integrations-aerospike 56.65% <ø> (-0.03%) ⬇️
apm-integrations-confluentinc-kafka-javascript 61.62% <ø> (-0.03%) ⬇️
apm-integrations-couchbase 57.08% <ø> (-0.04%) ⬇️
apm-integrations-http 62.79% <ø> (-0.03%) ⬇️
apm-integrations-kafkajs 62.17% <ø> (-0.03%) ⬇️
apm-integrations-next 59.20% <ø> (-0.03%) ⬇️
apm-integrations-prisma 58.68% <ø> (-0.03%) ⬇️
appsec 72.94% <ø> (-0.07%) ⬇️
appsec-express_fastify_graphql 70.45% <ø> (-0.02%) ⬇️
appsec-integration 51.44% <ø> (+<0.01%) ⬆️
appsec-kafka_ldapjs_lodash 63.99% <ø> (-0.03%) ⬇️
appsec-mongodb-core_mongoose_mysql 67.73% <ø> (-0.02%) ⬇️
appsec-next 57.51% <ø> (-0.02%) ⬇️
appsec-node-serialize_passport_postgres 67.40% <ø> (-0.02%) ⬇️
appsec-sourcing_stripe_template 65.73% <ø> (-0.02%) ⬇️
debugger 64.96% <ø> (-0.03%) ⬇️
instrumentations-bucket-0 51.61% <ø> (-0.03%) ⬇️
instrumentations-bucket-1 60.21% <ø> (-0.03%) ⬇️
instrumentations-bucket-10 61.79% <ø> (-0.03%) ⬇️
instrumentations-bucket-11 56.67% <ø> (-0.03%) ⬇️
instrumentations-bucket-12 51.94% <ø> (-0.03%) ⬇️
instrumentations-bucket-13 51.99% <ø> (-0.03%) ⬇️
instrumentations-bucket-2 53.28% <ø> (-0.03%) ⬇️
instrumentations-bucket-3 53.58% <ø> (-0.03%) ⬇️
instrumentations-bucket-4 59.21% <ø> (-0.03%) ⬇️
instrumentations-bucket-5 49.98% <ø> (-0.03%) ⬇️
instrumentations-bucket-6 60.93% <ø> (-0.03%) ⬇️
instrumentations-bucket-7 58.36% <ø> (-0.03%) ⬇️
instrumentations-bucket-8 59.44% <ø> (-0.03%) ⬇️
instrumentations-bucket-9 51.99% <ø> (-0.03%) ⬇️
instrumentations-instrumentation-couchbase 51.04% <ø> (-0.03%) ⬇️
instrumentations-instrumentation-zlib 51.61% <ø> (-0.03%) ⬇️
instrumentations-integration-esbuild 34.12% <ø> (ø)
llmobs-ai_anthropic_bedrock 62.64% <100.00%> (+0.04%) ⬆️
llmobs-bucket-1 61.84% <ø> (-0.02%) ⬇️
llmobs-openai 62.71% <ø> (-0.03%) ⬇️
llmobs-sdk 66.23% <ø> (-0.03%) ⬇️
llmobs-vertex-ai 59.18% <ø> (-0.03%) ⬇️
master-coverage 98.42% <100.00%> (?)
openfeature 53.98% <ø> (+<0.01%) ⬆️
openfeature-unit 52.72% <ø> (-0.03%) ⬇️
platform-core_esbuild_instrumentations-misc 40.37% <ø> (-0.02%) ⬇️
platform-integration 61.51% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 39.06% <ø> (-0.02%) ⬇️
plugins-bucket-0 57.06% <ø> (-0.03%) ⬇️
plugins-bucket-1 54.43% <ø> (ø)
plugins-bucket-11 61.85% <ø> (-0.48%) ⬇️
plugins-bucket-17 61.90% <ø> (?)
plugins-bucket-18 62.59% <ø> (+0.48%) ⬆️
plugins-bucket-19 61.69% <ø> (+1.56%) ⬆️
plugins-bucket-20 64.33% <ø> (+2.24%) ⬆️
plugins-bucket-4 58.59% <ø> (-0.03%) ⬇️
plugins-bullmq_cassandra_cookie 61.80% <ø> (-0.03%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 56.75% <ø> (-0.03%) ⬇️
plugins-fetch_fs_generic-pool 58.86% <ø> (-0.03%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 64.76% <ø> (-0.03%) ⬇️
plugins-hapi_hono_ioredis 60.27% <ø> (-0.03%) ⬇️
plugins-jest_knex_langgraph ?
plugins-jest_langgraph_ldapjs 55.57% <ø> (?)
plugins-ldapjs_light-my-request_limitd-client ?
plugins-light-my-request_limitd-client_lodash 58.65% <ø> (?)
plugins-lodash_mariadb_memcached ?
plugins-mariadb_memcached_mercurius 61.61% <ø> (?)
plugins-moleculer_mongodb_mongodb-core ?
plugins-mongodb_mongodb-core_mongoose 59.71% <ø> (?)
plugins-mongoose_multer_mysql ?
plugins-multer_mysql_mysql2 58.44% <ø> (?)
plugins-mysql2_nats_node-serialize ?
plugins-nats_node-serialize_opensearch 60.83% <ø> (?)
plugins-opensearch_passport-http_pino ?
plugins-passport-http_pino_postgres 58.66% <ø> (?)
plugins-postgres_process_pug ?
plugins-process_pug_redis 57.70% <ø> (?)
plugins-redis_router_sequelize ?
plugins-test-and-upstream-rhea_undici_url ?
plugins-undici_url_valkey 58.59% <ø> (?)
plugins-valkey_vm_winston ?
plugins-vm_winston_ws 59.96% <ø> (?)
plugins-ws ?
profiling 62.22% <ø> (-0.03%) ⬇️
serverless-aws-sdk-aws-sdk 55.08% <ø> (-0.03%) ⬇️
serverless-aws-sdk-bedrockruntime 54.77% <ø> (-0.03%) ⬇️
serverless-aws-sdk-client 56.44% <ø> (-0.03%) ⬇️
serverless-aws-sdk-dynamodb 55.68% <ø> (-0.03%) ⬇️
serverless-aws-sdk-eventbridge 49.38% <ø> (-0.03%) ⬇️
serverless-aws-sdk-kinesis 59.38% <ø> (-0.03%) ⬇️
serverless-aws-sdk-lambda 57.42% <ø> (-0.03%) ⬇️
serverless-aws-sdk-s3 55.62% <ø> (-0.03%) ⬇️
serverless-aws-sdk-serverless-peer-service 59.79% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sns 60.18% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sqs 60.61% <ø> (-0.03%) ⬇️
serverless-aws-sdk-stepfunctions 55.60% <ø> (-0.03%) ⬇️
serverless-aws-sdk-util 51.49% <ø> (-0.03%) ⬇️
serverless-bucket-0 54.32% <ø> (ø)
serverless-bucket-1 59.29% <ø> (-0.03%) ⬇️
test-optimization-cucumber 71.82% <ø> (+0.04%) ⬆️
test-optimization-cypress 65.80% <ø> (+0.07%) ⬆️
test-optimization-jest 73.30% <ø> (+<0.01%) ⬆️
test-optimization-mocha 73.47% <ø> (+0.04%) ⬆️
test-optimization-playwright-playwright-atr 60.42% <ø> (-0.02%) ⬇️
test-optimization-playwright-playwright-efd 60.60% <ø> (-0.01%) ⬇️
test-optimization-playwright-playwright-final-status 60.57% <ø> (-0.02%) ⬇️
test-optimization-playwright-playwright-impacted-tests 60.30% <ø> (+0.15%) ⬆️
test-optimization-playwright-playwright-reporting 60.20% <ø> (-0.02%) ⬇️
test-optimization-playwright-playwright-test-management 61.20% <ø> (+0.18%) ⬆️
test-optimization-playwright-playwright-test-span 60.33% <ø> (-0.06%) ⬇️
test-optimization-selenium 59.82% <ø> (-0.17%) ⬇️
test-optimization-testopt 58.46% <ø> (+0.08%) ⬆️
test-optimization-vitest 70.22% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

/**
* @param {unknown} value

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - we could probably better define this type at least with the knowledge we have below on the properties we access from each part

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would prefer we just write new tests in the existing test file for a more "end-to-end" testing experience. especially since the underlying utilities are also relying on object shapes from the actual ai sdk

@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-16-fix-ai-tool-results branch from aaa217b to aab8927 Compare July 20, 2026 18:14
BridgeAR added 3 commits July 21, 2026 03:17
AI SDK tool outputs can contain multipart content and error variants. Preserve text, replace file and image payloads with safe summaries, and fall back without throwing on malformed values.

Fixes: #9395
AI SDK 7 emits generic file and provider-reference parts that were reported as unparsable. Model the supported output shapes locally and exercise content outputs through both telemetry paths so SDK shape changes fail on the user path.
Adding toModelOutput changed the second provider request without a matching cassette, so every AI SDK v5-v7 matrix forwarded to OpenAI with the fake key. Keep the recorded workflow payload stable while formatter coverage pins the rich result shapes and schema precedence.
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-16-fix-ai-tool-results branch from aab8927 to d91d6d8 Compare July 21, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LLMObs Vercel AI integration cannot parse content tool results

2 participants