Skip to content

feat(AIC-3408): add Vercel AI SDK messages and agents adapters - #103

Open
andrewklatzke wants to merge 7 commits into
mainfrom
aklatzke/AIC-3408/vercel-adapter
Open

andrewklatzke wants to merge 7 commits into
mainfrom
aklatzke/AIC-3408/vercel-adapter

Conversation

@andrewklatzke

Copy link
Copy Markdown
Contributor

Summary

  • Add launchdarkly-ai-vercel-messages and launchdarkly-ai-vercel-agents packages that map LaunchDarkly AI Configs onto the official Python ai runtime and AI Gateway creator/model ids.
  • Execute tool loops, structured output, usage accumulation, and native graph handoffs instead of reading nonexistent stream fields or stopping at the first tool call.
  • Include runnable examples for gateway, injected-OpenAI, and native-graph paths, plus release-please and workspace wiring.

Test plan

  • make format-check && make lint && make typecheck && make test in python/
  • Run uv run python main.py vercel-agents launch-darkly-documentation-summarizer "..." and confirm a non-empty response, non-zero usage, and a judge score
  • Run vercel-messages and vercel-direct success/failure keys from integration-config.json
  • Confirm native-graph-vercel fails cleanly if the Gateway free tier still blocks the graph model

Made with Cursor

Route LaunchDarkly AI Configs through the official Python ai runtime and AI Gateway, including native graph execution and a direct-model opt-out.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .sdk_metadata.json
Comment thread packages/vercel-messages/src/launchdarkly_ai_vercel_messages/handler.py Outdated
Comment thread packages/vercel-agents/src/launchdarkly_ai_vercel_agents/handler.py Outdated
Use the shared span helpers in production, trace tool execution, and emit provider-compatible strict schemas for messages output.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/vercel-agents/src/launchdarkly_ai_vercel_agents/handler.py
CancelledError is not an Exception, so those spans were ending unmarked or as abandoned. Handoff tools now ignore extra model arguments instead of raising TypeError.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/vercel-messages/src/launchdarkly_ai_vercel_messages/handler.py Outdated
Comment thread packages/vercel-messages/src/launchdarkly_ai_vercel_messages/handler.py Outdated
Tool loops were collapsing every inference into one span and forcing the final schema onto intermediate tool calls, and the native graph span omitted the token totals the other adapters write.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 89c52d5. Configure here.

results = [await _tool_result(call, executors, parent) for call in calls]
messages = [*messages, message, ai.tool_message(*results)]
raise RuntimeError(
f"Vercel messages run did not reach a final response within {MAX_STEPS} steps"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Structured follow-up can exhaust step limit

Medium Severity

When outputFormat and tools are both set, a no-tool-call turn now continues so a later constrained request can apply the schema. That extra iteration still counts against MAX_STEPS. If the unconstrained final answer arrives on the last allowed step, the loop ends and raises RuntimeError instead of performing the structured turn, so a completed tool loop with structured output fails.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 89c52d5. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants