docs(migration): pinned @ai-sdk/open-responses Agent API example (OpenCode cleanup, draft for Andrew) - #9
Draft
connectors-testing-pplx wants to merge 2 commits into
Conversation
… independent of models.dev OpenCode integration cleanup for the Sonar -> Agent API migration. Adds a runnable Vercel AI SDK example that reaches the Agent API through @ai-sdk/open-responses pointed at https://api.perplexity.ai/v1/responses, pinned to verified-compatible versions (ai@7.0.93, @ai-sdk/open-responses@2.0.39), and explicitly independent of models.dev (the model id is passed straight through to the provider factory; no registry lookup at runtime). - examples/vercel-ai-sdk/agent-api-openresponses.mjs: standalone runnable example (generateText + fetch hook for web_search/sources; status branching for 200-wrapped failures; preset note). - examples/vercel-ai-sdk/README.md: setup, run, full Agent API field mapping, models.dev-independence rationale, version-pinning table, streaming/preset variants, and live-test evidence. - references/integration-styles.md: new "Vercel AI SDK" section (style (e)) covering version pinning, no models.dev dependency, web_search via fetch hook, citations in the output array, 200-wrapped failures, server-side provider creation, and the minimal shape. - SKILL.md: add style (e) Vercel AI SDK to the Step 1 integration-style list with a pointer to the runnable example. Live-tested against production: with no key the example returns a clean HTTP 401 from api.perplexity.ai/v1/responses (the path resolves; not a transport/DNS/registry error), proving the Agent API path works without a models.dev dependency.
Tracks the OpenCode integration cleanup status and captures the live-test evidence for API-3600 (Linear connector session expired; this file is the durable record until the session is restored and the comment can be posted).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenCode integration cleanup for the Sonar → Agent API migration. Adds a runnable, pinned Vercel AI SDK (
@ai-sdk/open-responses) example that reaches the Agent API through Perplexity's/v1/responsesendpoint, independent of models.dev.This is a Draft PR for Andrew to review — not ready for review, no reviewers requested, do not merge or publish.
Why
The live docs page (Perplexity with the Vercel AI SDK) shows the provider setup but ships no standalone runnable file and does not call out two production-relevant points:
aiand@ai-sdk/open-responsesmove fast; a floating install can pull a release that changes the provider protocol or thecreateOpenResponsessignature.@ai-sdk/open-responsesdoes not use the models.dev registry at runtime; the model id passed to the provider factory is sent straight through to the API. The Agent API path keeps working even if models.dev is unavailable or changes. This example makes that explicit.What changed
examples/vercel-ai-sdk/agent-api-openresponses.mjs— standalone runnable example:generateText+fetchhook forweb_searchinjection andsearch_resultssource capture;statusbranching for 200-wrapped failures; preset note.examples/vercel-ai-sdk/README.md— setup, run, full Agent API field mapping, models.dev-independence rationale, version-pinning table, streaming/preset variants, and live-test evidence.references/integration-styles.md— new "Vercel AI SDK" section (integration style (e)) covering version pinning, no models.dev dependency,web_searchvia fetch hook, citations in the output array, 200-wrapped failures, server-side provider creation, and the minimal shape.SKILL.md— add style (e) Vercel AI SDK to the Step 1 integration-style list with a pointer to the runnable example.Verified versions
ai7.0.93@ai-sdk/open-responses2.0.39Install and run together on Node 20+ (packages declare
node>=22; Node 20 works but emits an engine warning).Live-test evidence
Captured against production with no API key (proves the path resolves, not just that it compiles):
A clean HTTP 401 from
api.perplexity.ai/v1/responses— not a transport, DNS, or registry error. With a valid key the run returnsstatus: completed, answer text, and a populatedsearch_resultsarray. The example is explicitly independent of models.dev (no registry lookup at runtime).Notes for review
/v1/responsesURL is the OpenAI-compatible alias of the canonical/v1/agentendpoint — both reach the Agent API; this matches the existing live docs page.