feat(vercel): add variations for streaming/blocking, anthropic/openai and functions/ToolLoopAgent#129
Conversation
… and functions/ToolLoopAgent
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
🔴 AI SDK Integration Test ResultsStatus: 3 regressions detected Summary
🔴 RegressionsThese tests were passing on main but are now failing: cloudflare/vercel :: Basic Embeddings Test (blocking)Error: Test execution failed: Wrangler exited with code 1 browser/langchain :: Multi-Turn LLM Test (streaming)Error: Browser test timed out (60s) nextjs/google-genai :: Multi-Turn LLM Test (blocking)Error: 3 check(s) failed: ✅ FixedThese tests were failing on main but are now passing:
🆕 New TestsPassing (71):
Failing (73): ❌ cloudflare/vercel :: Basic Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Basic Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Basic Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Basic Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Tool Call Agent Test (streaming, class, openai)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Call Agent Test (streaming, class, anthropic)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Call Agent Test (blocking, class, openai)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Call Agent Test (blocking, class, anthropic)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Error Agent Test (streaming, class, openai)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Error Agent Test (streaming, class, anthropic)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Error Agent Test (blocking, class, openai)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Tool Error Agent Test (blocking, class, anthropic)Error: 3 check(s) failed: ❌ cloudflare/vercel :: Vision Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Vision Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Vision Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Vision Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Long Input Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Long Input Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Long Input Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Long Input Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Conversation ID Agent Test (streaming, function, anthropic)Error: Test execution failed: Wrangler exited with code 1 ❌ cloudflare/vercel :: Conversation ID Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Conversation ID Agent Test (streaming, class, anthropic)Error: Test execution failed: Wrangler exited with code 1 ❌ cloudflare/vercel :: Conversation ID Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ cloudflare/vercel :: Conversation ID Agent Test (blocking, class, anthropic)Error: Test execution failed: Wrangler exited with code 1 ❌ nextjs/vercel :: Basic Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Basic Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Basic Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Basic Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Tool Call Agent Test (streaming, class, openai)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Call Agent Test (streaming, class, anthropic)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Call Agent Test (blocking, class, openai)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Call Agent Test (blocking, class, anthropic)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Error Agent Test (streaming, class, openai)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Error Agent Test (streaming, class, anthropic)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Error Agent Test (blocking, class, openai)Error: 3 check(s) failed: ❌ nextjs/vercel :: Tool Error Agent Test (blocking, class, anthropic)Error: 3 check(s) failed: ❌ nextjs/vercel :: Vision Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Vision Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Vision Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Vision Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Long Input Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Long Input Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Long Input Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Long Input Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Conversation ID Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Conversation ID Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ nextjs/vercel :: Conversation ID Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ nextjs/vercel :: Conversation ID Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ node/vercel :: Basic Agent Test (streaming, class, openai)Error: 2 check(s) failed: ❌ node/vercel :: Basic Agent Test (streaming, class, anthropic)Error: 2 check(s) failed: ❌ node/vercel :: Basic Agent Test (blocking, class, openai)Error: 2 check(s) failed: ❌ node/vercel :: Basic Agent Test (blocking, class, anthropic)Error: 2 check(s) failed: ❌ node/vercel :: Tool Call Agent Test (streaming, class, openai)Error: 3 check(s) failed: |
| {% if user_content is iterable and user_content is not string %} | ||
| const { text } = await agent.generate({ | ||
| {% if system_content %} | ||
| system: "{{ system_content }}", |
There was a problem hiding this comment.
according to https://ai-sdk.dev/docs/reference/ai-sdk-core/tool-loop-agent#parameters there is no system parameter for this methods (similar for agent.stream()). system instructions need to be set using instructions in the ToolLoopAgent constructor. I think this needs to be fixed for the other templates as well
| system: "{{ system_content }}", | ||
| {% endif %} | ||
| prompt: "{{ user_content }}", | ||
| experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true }, |
There was a problem hiding this comment.
this also needs to be set in the constructor of the agent (same for the other templates): https://ai-sdk.dev/docs/reference/ai-sdk-core/tool-loop-agent#experimental_telemetry
There was a problem hiding this comment.
Should be fixed now as well
| try { | ||
| {% if agentStyle == "class" %} | ||
| // ToolLoopAgent class-based approach | ||
| const agent = new ToolLoopAgent({ |
There was a problem hiding this comment.
here we are missing the experimental_telemetry option
| messages: [ | ||
| { | ||
| role: "user", | ||
| content: {{ renderVercelContent(user_content) }}, | ||
| }, | ||
| ], | ||
| {% if agent and agent.tools and agent.tools.length > 0 %} | ||
| tools, | ||
| stopWhen: stepCountIs(10), | ||
| {% endif %} | ||
| }); |
There was a problem hiding this comment.
Bug: The streamText calls in the function-based streaming path for the node template are missing the experimental_telemetry parameter, which prevents telemetry capture for these operations.
Severity: MEDIUM
Suggested Fix
Add the experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true } parameter to the streamText calls within the function-based streaming path in src/runner/templates/agents/node/vercel/template.njk to match the implementation in the generateText calls and other templates.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/runner/templates/agents/node/vercel/template.njk#L140-L155
Potential issue: In the node agent template, the `streamText` function calls for the
function-based streaming path are missing the `experimental_telemetry` parameter. This
omission prevents Sentry's AI SDK from capturing telemetry spans for these specific LLM
operations. This is inconsistent with the blocking `generateText` calls in the same file
and with the equivalent `streamText` calls in the Cloudflare and NextJS templates, all
of which include this parameter. The consequence is a loss of observability for
streaming operations on the node platform when using the "function" agent style, which
will cause span validation checks to fail.

Contributes to https://linear.app/getsentry/issue/TET-2149/add-support-for-vercel-ai-sdks-toolloopagent
Contributes to https://linear.app/getsentry/issue/TET-2164/add-variations-to-for-providers-for-the-higher-level-frameworks