Skip to content

feat(agents): register Vercel fx agent - #1053

Closed
AdnanElAssadi wants to merge 4 commits into
benchflow-ai:mainfrom
AdnanElAssadi:fx-agent
Closed

feat(agents): register Vercel fx agent#1053
AdnanElAssadi wants to merge 4 commits into
benchflow-ai:mainfrom
AdnanElAssadi:fx-agent

Conversation

@AdnanElAssadi

@AdnanElAssadi AdnanElAssadi commented Aug 23, 2026

Copy link
Copy Markdown

related to https://github.com/benchflow-ai/FrontierPhysics/issues/53

fx speaks ACP natively (fx acp) and only talks to the Vercel AI Gateway, so it joins _NATIVE_PROTOCOL_AGENTS and skips the LiteLLM proxy; usage comes from the agent protocol response.


Open in Devin Review

AdnanElAssadi and others added 2 commits August 23, 2026 13:03
Register vercel/ in the provider registry so gateway models
(vercel/<creator>/<model>, e.g. vercel/anthropic/claude-sonnet-4.5)
route through the LiteLLM proxy with AI_GATEWAY_API_KEY. Declares the
OpenAI-compatible completions/responses surfaces at /v1 and the
Anthropic Messages surface at the root, so claude-agent-acp,
codex-acp, and openhands can all run via the gateway.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 1 additional finding in Devin Review. (Configure)

Open in Devin Review

Comment on lines +1006 to +1012
requires_env=["AI_GATEWAY_API_KEY"],
# fx speaks the AI SDK gateway wire protocol, so the proxy is skipped
# via _NATIVE_PROTOCOL_AGENTS in providers/litellm_runtime.py.
env_mapping={
"BENCHFLOW_PROVIDER_API_KEY": "AI_GATEWAY_API_KEY",
"BENCHFLOW_PROVIDER_MODEL": "FX_MODEL",
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 fx rejected for vendor-named gateway models

When fx runs with a gateway model whose name contains a known vendor (e.g. the test's vercel/anthropic/claude-sonnet-4.5), infer_env_key_for_model returns ANTHROPIC_API_KEY and resolve_agent_env demands it. fx only takes AI_GATEWAY_API_KEY, which is absent from _EXPLICIT_AGENT_NATIVE_BRIDGE_KEYS, so validation raises and the run aborts before launch.

Prompt for agents
The fx AgentConfig maps its provider API key to AI_GATEWAY_API_KEY (env_mapping BENCHFLOW_PROVIDER_API_KEY -> AI_GATEWAY_API_KEY, requires_env=["AI_GATEWAY_API_KEY"]). But resolve_agent_env in src/benchflow/agents/env.py only special-cases 'oracle' at line 692; fx runs the full model-based key validation. For a gateway model like 'vercel/anthropic/claude-sonnet-4.5', infer_env_key_for_model falls through to the name heuristic and returns ANTHROPIC_API_KEY (registry.py ~1057). The bridge-key check (env.py ~723-738) only treats AI_GATEWAY_API_KEY as satisfying the requirement if it is in _EXPLICIT_AGENT_NATIVE_BRIDGE_KEYS (currently only {"LLM_API_KEY"}) or shares an _AUTH_CONTEXT_GROUPS entry with the inferred key. Neither holds, so validation raises 'ANTHROPIC_API_KEY required ...' and fx never launches for any gateway model whose name contains claude/gpt/gemini/opus/sonnet/haiku/o1/o3. Consider adding AI_GATEWAY_API_KEY to _EXPLICIT_AGENT_NATIVE_BRIDGE_KEYS, or registering a 'vercel' provider whose auth_env is AI_GATEWAY_API_KEY so find_provider resolves the required key correctly, or otherwise exempting native-protocol agents that supply their own gateway key from provider-key inference.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

f" {_apt_install('curl', 'ca-certificates')} ) && "
# Shared prefix so the sandbox user inherits the binary.
"export FX_INSTALL_DIR=/usr/local/bin && "
f"curl -fsSL https://fx.sh/setup.sh | bash -s -- {_FX_VERSION} && "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟨 Unverified remote install script piped to bash

The fx install fetches https://fx.sh/setup.sh and pipes it into bash -s. The version argument is pinned but the script body is not checksummed or signature-verified, so a compromised or tampered host runs arbitrary code in the sandbox. This matches the repo's existing curl | sh installers, so it is a hardening note rather than a new class of exposure.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

fx speaks ACP natively (fx acp) and only talks to the Vercel AI
Gateway, so it joins _NATIVE_PROTOCOL_AGENTS and skips the LiteLLM
proxy; usage comes from the agent protocol response.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AdnanElAssadi added a commit to AdnanElAssadi/benchflow that referenced this pull request Aug 23, 2026
Guards PR benchflow-ai#1053 against the review finding that vendor-named gateway
models demanded ANTHROPIC_API_KEY when the vercel provider was absent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Guards PR benchflow-ai#1053 against the review finding that vendor-named gateway
models demanded ANTHROPIC_API_KEY when the vercel provider was absent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AdnanElAssadi

Copy link
Copy Markdown
Author

Folded into #1052 to keep the Vercel AI changes together.

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.

1 participant