Add AI Gateway integration docs#2059
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an AI Gateway integrations overview and navigation entries for multiple frameworks and SDKs. New reference pages document gateway configuration, API key setup, OpenAI-compatible or provider-native routes, runnable examples across Python, TypeScript, Go, .NET, and JavaScript, verification guidance, telemetry behavior, spending visibility, and troubleshooting. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/integrations/agent-frameworks/mastra.md`:
- Line 169: The agent lookup in the Mastra examples uses the wrong identifier,
so update the calls to match the registered id used in the setup code. In the
relevant snippets around the getAgent usage, replace the mismatched weatherAgent
lookup with the registered weather-agent id, and apply the same correction in
the gateway example so both examples resolve the same agent consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 193c5756-4fee-4f61-87dc-68c68039c2b0
📒 Files selected for processing (2)
docs/integrations/agent-frameworks/mastra.mddocs/integrations/agent-frameworks/vercel-ai-sdk.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
pydantic/logfire(manual)pydantic/pydantic-ai(manual)pydantic/pydantic(auto-detected)
There was a problem hiding this comment.
3 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/integrations/agent-frameworks/mastra.md">
<violation number="1">
P1: The agent's weather tool won't work: `execute: async ({ context })` destructures `context` from the tool's input data, but the inputSchema defines `{ city }`, so `context` is `undefined` and `context.city` collapses at runtime. The first parameter is the validated input fields directly (`inputData: TSchemaIn`); the execution context is the second parameter. Change to `execute: async ({ city }) => ({ city, tempC: 21 })`.</violation>
<violation number="2">
P2: The example no longer flushes telemetry before exit. Short-lived scripts that make one agent call and exit immediately risk losing all trace data because the OTLP batch exporter may not have sent the spans before the process terminates. Add `await mastra.observability.flush()` before `console.log()` or in a `finally` block, and mention the flush requirement in the Common pitfalls section so readers don't copy a silently broken pattern.</violation>
</file>
<file name="docs/integrations/agent-frameworks/vercel-ai-sdk.md">
<violation number="1">
P1: TypeScript/ESM syntax error: `import` declarations cannot follow a statement. The code block shows `import * as logfire from '...'`, then `logfire.configure(...)`, then more `import { ... } from 'ai'`. This will fail to parse with tsx, ts-node, or any TypeScript compiler. Move all imports to the top of the file before any statements.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/reference/advanced/gateway/agent-frameworks.md`:
- Around line 31-33: The gateway docs use inconsistent environment variable
names between the agent-frameworks page and the gateway index page; choose a
single canonical name and update both references to match, or explicitly
document why `LOGFIRE_GATEWAY_API_KEY` and `PYDANTIC_AI_GATEWAY_API_KEY` differ.
Update the env schema example in the gateway docs and the corresponding mention
in the index page so readers see one consistent gateway API key variable name
throughout.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b86febdf-a969-4c78-a32e-9f07acabc9fa
📒 Files selected for processing (1)
docs/reference/advanced/gateway/agent-frameworks.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
pydantic/logfire(manual)pydantic/pydantic-ai(manual)pydantic/pydantic(auto-detected)
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
18fea2e to
784ad87
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/reference/advanced/gateway/integrations/genkit.md`:
- Line 8: The first sentence in the Genkit integration page uses “AI” before
spelling it out, so update the opening wording in the Genkit documentation to
expand the acronym on first use. Adjust the introductory sentence in this page
so “AI” appears as “artificial intelligence” (or equivalent) before any later
use of “AI,” keeping the rest of the Genkit and LOGFIRE_GATEWAY_API_KEY guidance
unchanged.
In `@docs/reference/advanced/gateway/integrations/microsoft-agent-framework.md`:
- Line 8: The opening sentence uses acronyms before defining them, so update the
intro in Microsoft Agent Framework documentation to spell out “software
development kit” and “artificial intelligence” at first use. Keep the same
meaning, but revise the first sentence in this page so the expanded forms appear
before SDK and AI are used later.
In `@docs/reference/advanced/gateway/integrations/semantic-kernel.md`:
- Line 8: The opening sentence in Semantic Kernel docs uses acronyms before
spelling them out; update the first mention in the intro to expand SDK and AI on
first use. Adjust the sentence around the Microsoft Semantic Kernel description
so it reads with the full terms before any abbreviations, following the docs/
first-use acronym rule. Keep the rest of the gateway setup guidance unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 62a779fd-f4e9-4452-a902-2d6379cbde72
📒 Files selected for processing (18)
docs/nav.jsondocs/reference/advanced/gateway/agent-frameworks.mddocs/reference/advanced/gateway/integrations/agno.mddocs/reference/advanced/gateway/integrations/genkit.mddocs/reference/advanced/gateway/integrations/google-adk.mddocs/reference/advanced/gateway/integrations/haystack.mddocs/reference/advanced/gateway/integrations/instructor.mddocs/reference/advanced/gateway/integrations/langchain.mddocs/reference/advanced/gateway/integrations/llamaindex.mddocs/reference/advanced/gateway/integrations/mastra.mddocs/reference/advanced/gateway/integrations/microsoft-agent-framework.mddocs/reference/advanced/gateway/integrations/openai-agents-sdk.mddocs/reference/advanced/gateway/integrations/openai-sdk.mddocs/reference/advanced/gateway/integrations/semantic-kernel.mddocs/reference/advanced/gateway/integrations/smolagents.mddocs/reference/advanced/gateway/integrations/strands-agents.mddocs/reference/advanced/gateway/integrations/vercel-ai-sdk.mddocs/reference/advanced/gateway/integrations/voltagent.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
pydantic/logfire(manual)pydantic/pydantic-ai(manual)pydantic/pydantic(auto-detected)
✅ Files skipped from review due to trivial changes (13)
- docs/reference/advanced/gateway/integrations/openai-agents-sdk.md
- docs/reference/advanced/gateway/integrations/voltagent.md
- docs/reference/advanced/gateway/integrations/haystack.md
- docs/reference/advanced/gateway/integrations/instructor.md
- docs/reference/advanced/gateway/integrations/llamaindex.md
- docs/reference/advanced/gateway/integrations/vercel-ai-sdk.md
- docs/reference/advanced/gateway/integrations/strands-agents.md
- docs/reference/advanced/gateway/integrations/smolagents.md
- docs/reference/advanced/gateway/integrations/openai-sdk.md
- docs/reference/advanced/gateway/integrations/google-adk.md
- docs/reference/advanced/gateway/integrations/agno.md
- docs/reference/advanced/gateway/integrations/langchain.md
- docs/reference/advanced/gateway/agent-frameworks.md
Copy-only pass on the AI Gateway integration pages to match the voice
already used in the gateway overview:
- Drop spelled-out acronyms ("software development kit (SDK)", "large
language model (LLM)", "retrieval-augmented generation (RAG)") — the
sibling docs write SDK/LLM/RAG bare.
- Remove the verbatim "set LOGFIRE_GATEWAY_API_KEY to a key from..."
clause repeated on every page; the env var is shown in each code
block and in the overview's "Before you start".
- Drop "popular" from the LangChain description.
- Overview: note the EU gateway host and tighten the URL paragraph.
Claude-Session: https://claude.ai/code/session_01QSWKYbQCiNKsL8RdAZhQBN
There was a problem hiding this comment.
1 issue found across 16 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/reference/advanced/gateway/integrations/instructor.md">
<violation number="1" location="docs/reference/advanced/gateway/integrations/instructor.md:8">
P3: The description paragraph uses a different sentence structure than the other 15 integration pages, which consistently follow an imperative "To route its model calls through the Logfire AI Gateway, configure/set up X..." pattern. Consider aligning this description with that established convention for consistency.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…ramework-gateway-docs # Conflicts: # docs/nav.json
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/reference/advanced/gateway/integrations/index.md`:
- Line 14: Replace deployment-specific `/logfire` documentation links with
source-relative `.md` links at
docs/reference/advanced/gateway/integrations/index.md lines 14, 26, and 54;
docs/reference/advanced/gateway/embeddings.md lines 8, 51, and 125; and
docs/reference/advanced/gateway/index.md line 165. Use the corresponding targets
`../index.md#enable-the-gateway`, `../index.md#connect-an-sdk`, `../index.md`,
`index.md#providers`, `index.md#connect-an-sdk`, `index.md`, and `embeddings.md`
respectively.
In `@docs/reference/advanced/gateway/integrations/smolagents.md`:
- Around line 14-15: Add the `smolagents[openai]` installation prerequisite
before the example in the Smolagents integration documentation, ensuring the
required OpenAI extra is explicitly installed alongside the existing project and
gateway setup instructions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ce47902b-7ed2-4612-868a-977c9690185b
📒 Files selected for processing (20)
docs/nav.jsondocs/reference/advanced/gateway/embeddings.mddocs/reference/advanced/gateway/index.mddocs/reference/advanced/gateway/integrations/agno.mddocs/reference/advanced/gateway/integrations/genkit.mddocs/reference/advanced/gateway/integrations/google-adk.mddocs/reference/advanced/gateway/integrations/haystack.mddocs/reference/advanced/gateway/integrations/index.mddocs/reference/advanced/gateway/integrations/instructor.mddocs/reference/advanced/gateway/integrations/langchain.mddocs/reference/advanced/gateway/integrations/llamaindex.mddocs/reference/advanced/gateway/integrations/mastra.mddocs/reference/advanced/gateway/integrations/microsoft-agent-framework.mddocs/reference/advanced/gateway/integrations/openai-agents-sdk.mddocs/reference/advanced/gateway/integrations/openai-sdk.mddocs/reference/advanced/gateway/integrations/semantic-kernel.mddocs/reference/advanced/gateway/integrations/smolagents.mddocs/reference/advanced/gateway/integrations/strands-agents.mddocs/reference/advanced/gateway/integrations/vercel-ai-sdk.mddocs/reference/advanced/gateway/integrations/voltagent.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
pydantic/logfire(manual)pydantic/pydantic-ai(manual)pydantic/platform(auto-detected)pydantic/pydantic(auto-detected)
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/reference/advanced/gateway/integrations/google-adk.md
There was a problem hiding this comment.
All reported issues were addressed across 21 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/reference/advanced/gateway/integrations/smolagents.md (1)
27-32: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse the current Smolagents model class
OpenAIServerModelis the legacy API; current Smolagents docs useOpenAIModel. Update the example to match the supported release, or pinsmolagentsif this is meant for an older version.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/reference/advanced/gateway/integrations/smolagents.md` around lines 27 - 32, Update the Smolagents example to use the current OpenAIModel class instead of the legacy OpenAIServerModel in the model initialization, or explicitly pin smolagents to the older version if retaining the legacy class.docs/reference/advanced/gateway/integrations/langchain.md (1)
63-63: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winLog the final message, not the whole agent state.
agent.invoke()returns the full state object, soconsole.log(result)prints the entire conversation state rather than just the response. Log the last message content instead.Suggested fix
-console.log(result); +console.log(result.messages[result.messages.length - 1]?.content);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/reference/advanced/gateway/integrations/langchain.md` at line 63, Update the logging after agent.invoke so it prints the final message content from the returned agent state rather than the entire result object. Preserve the existing invocation flow and access the last message in the returned messages collection.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/reference/advanced/gateway/integrations/langchain.md`:
- Line 63: Update the logging after agent.invoke so it prints the final message
content from the returned agent state rather than the entire result object.
Preserve the existing invocation flow and access the last message in the
returned messages collection.
In `@docs/reference/advanced/gateway/integrations/smolagents.md`:
- Around line 27-32: Update the Smolagents example to use the current
OpenAIModel class instead of the legacy OpenAIServerModel in the model
initialization, or explicitly pin smolagents to the older version if retaining
the legacy class.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b129337-6cef-493a-a82f-f4e0dcd5c9e0
📒 Files selected for processing (19)
docs/nav.jsondocs/navigation.ymldocs/reference/advanced/gateway/integrations/agno.mddocs/reference/advanced/gateway/integrations/genkit.mddocs/reference/advanced/gateway/integrations/google-adk.mddocs/reference/advanced/gateway/integrations/haystack.mddocs/reference/advanced/gateway/integrations/index.mddocs/reference/advanced/gateway/integrations/instructor.mddocs/reference/advanced/gateway/integrations/langchain.mddocs/reference/advanced/gateway/integrations/llamaindex.mddocs/reference/advanced/gateway/integrations/mastra.mddocs/reference/advanced/gateway/integrations/microsoft-agent-framework.mddocs/reference/advanced/gateway/integrations/openai-agents-sdk.mddocs/reference/advanced/gateway/integrations/openai-sdk.mddocs/reference/advanced/gateway/integrations/semantic-kernel.mddocs/reference/advanced/gateway/integrations/smolagents.mddocs/reference/advanced/gateway/integrations/strands-agents.mddocs/reference/advanced/gateway/integrations/vercel-ai-sdk.mddocs/reference/advanced/gateway/integrations/voltagent.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
pydantic/logfire(manual)pydantic/pydantic-ai(manual)pydantic/platform(auto-detected)pydantic/pydantic(auto-detected)
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/reference/advanced/gateway/integrations/index.md
- docs/nav.json
- docs/reference/advanced/gateway/integrations/google-adk.md
Summary:
docs/nav.jsonand repository-owneddocs/navigation.ymlmanifests, using canonical/logfire/manage/ai-gateway/integrations/...routes.Checks:
uv run prek --files docs/navigation.yml docs/nav.json docs/reference/advanced/gateway/embeddings.md docs/reference/advanced/gateway/index.md docs/reference/advanced/gateway/integrations/*.md