Add frames agent#163
Closed
jbouder wants to merge 4 commits into
Closed
Conversation
Replace the static mcp_token with per-user auth: the authenticator now keeps the raw bearer token on User.data, and the frames agent forwards it on every MCP request via an httpx auth hook fed by a context variable seeded at the start of each run. The frames endpoint validates the token as long as its aud claim includes the MCP resource identifier, which an audience mapper on the chat Keycloak client provides. Capabilities are now declared statically instead of extracted at boot: extraction opens an MCP connection outside any run, where no user token exists, and the now-authenticated endpoint would 401 and fail startup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pmeier
reviewed
Jul 3, 2026
pmeier
previously requested changes
Jul 3, 2026
pmeier
left a comment
Member
There was a problem hiding this comment.
With #164 merged, all the MCP handling in this PR is superseded. The only thing left is setting the agent name and system prompt. Both can be set through the agent constructor and thus directly through the ravnar config. Meaning, unless we need anything beyond the MCP connection and the system prompt, this PR does not add anything.
Member
|
@jbouder I cleaned up the branch after #164 was merged. As of now a valid config for this branch could look like agents:
static:
frames:
cls_or_fn: ravnar_nebari_chat.make_frames_agent
params:
agent:
cls_or_fn: pydantic_ai.Agent
params:
model:
cls_or_fn: pydantic_ai.models.google.GoogleModel
params:
model_name: gemini-flash-latest
provider:
cls_or_fn: pydantic_ai.providers.google.GoogleProvider
params:
api_key: '{{ GOOGLE_API_KEY }}'
mcp_url: "http://my-mcp-server"
oidc_issuer: "http://keycloak-keycloakx-http.keycloak.svc.cluster.local:8080/realms/nebari"
client_id: '{{ CLIENT_SECRET }}'
client_secret: '{{ CLIENT_SECRET }}'However, as explained here likely this branch is not needed. Here is how to get the exact same result on top of agents:
static:
frames:
cls_or_fn: ravnar.agents.PydanticAiAgentWrapper
params:
agent:
cls_or_fn: pydantic_ai.Agent
params:
model:
cls_or_fn: pydantic_ai.models.google.GoogleModel
params:
model_name: gemini-flash-latest
provider:
cls_or_fn: pydantic_ai.providers.google.GoogleProvider
params:
api_key: '{{ GOOGLE_API_KEY }}'
name: Nebari Frames Agent
system_prompt: |
You are an agent that answers the user's questions using the
nebari-frames tools. Those tools are provided over MCP; inspect the
tools available to you and call them to fetch data and perform
actions rather than guessing.
Prefer calling a tool over answering from memory whenever the answer
depends on live data. When a tool fails or returns nothing useful,
explain what you tried instead of inventing a result.
toolsets:
- cls_or_fn: ravnar_nebari_mcp.ImpersonatingMCPToolset
params:
mcp_toolset_factory:
cls_or_fn: ravnar_nebari_mcp.bearer_token_mcp_toolset_factory
params:
url: http://my-mcp-server
impersonator:
cls_or_fn: ravnar_nebari_mcp.OIDCImpersonator
params:
issuer: http://keycloak-keycloakx-http.keycloak.svc.cluster.local:8080/realms/nebari
client_id: '{{ CLIENT_ID }}'
client_secret: '{{ IMPERSONATOR_CLIENT_SECRET }}' |
Contributor
Author
|
It works! Closing this PR. |
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.
Reference Issues or PRs
What does this implement/fix?
Put a
xin the boxes that applyTesting
Documentation
Access-centered content checklist
Text styling
H1or#in markdown).Non-text content
Any other comments?