Registries for agents and model providers; openai-compatible provider - #6
Open
mattteufel-e2b wants to merge 1 commit into
Open
mattteufel-e2b wants to merge 1 commit into
mattteufel-e2b wants to merge 1 commit into
Conversation
…le provider The runtime, CLI, bundle builder, network gate, and result parser no longer know about Codex, OpenHands, Fireworks, or Bedrock by name. Two small registries carry that knowledge: - agents.AgentHarness: upstream --agent name, wire API, whether the agent installs tooling at runtime, scripts to ship in the bundle, model-ID rewrite, optional trajectory reader for interrupted turns. - providers.ModelProvider: endpoint(host, base_url) from (wire API, region, base URL, key env) plus the credential env names. CLI choices, preflight key reporting, the allowlist gate, bundle contents, and the experiment fingerprint all derive from the registries. New provider `openai-compatible` takes --model-base-url and --model-key-env so any HTTPS OpenAI-compatible endpoint (OpenAI, vLLM, OpenRouter, ...) works with no code change; api.openai.com added to both packaged policies. Flag changes (0.4.0): --remote-install-codex -> --bundle-script NAME=PATH (repeatable, agent-agnostic); --bedrock-region -> --model-region. Fingerprint field remote_install_codex_sha256 -> bundle_scripts_sha256 map. Tests 55 -> 62; new tests/test_agents_providers.py covers registry-derived CLI choices, the custom provider, credential lookup, per-agent bundle scripts, fingerprint coverage, and the Codex trajectory reader. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
Live evidence from this branch (2026-09-15):
|
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.
Why
The adapter should be easy to point at any model endpoint and, later, any agent upstream supports, without threading vendor names through the runtime. Before this PR,
codex/openhands/fireworks/bedrockappeared as literals inRunOptions,_model_config,_summary_wire_api,_agent_model_id,_require_runnable_policy,_benchmark_result,_already_completed, argparse choices, preflight output, and the bundle builder.Design
Two registries, each a frozen dataclass plus a dict:
agents.AgentHarness(src/cybergym_e2b/agents.py): upstream--agentname;wire_api(responses|chat-completions);installs_tooling_at_runtime(drives the allowlist gate);bundle_scripts(files shipped intoscripts/, e.g. the hardened Codex installer);model_id(OpenHands'openai/prefix); optionalturn_state(Codex trajectory reader that separates an interrupted turn from a graded failure).providers.ModelProvider(src/cybergym_e2b/providers.py):endpoint(EndpointRequest) -> Endpoint(host, base_url)andkey_envnames. Fireworks and Bedrock Mantle are fixed entries.openai-compatibletakes--model-base-urland--model-key-env, so OpenAI, vLLM, OpenRouter, or an internal gateway work with no code change. The credential still never enters the sandbox; E2B's proxy injects it on the endpoint host only.Everything downstream reads the registries: CLI
--agent/--providerchoices, preflight'sprovider_keys_present,_require_runnable_policy, bundle contents,_benchmark_result, batch reuse, and the experiment fingerprint (bundle_scripts_sha256map replacesremote_install_codex_sha256).Adding an agent upstream already runs is one
AGENTSentry. Adding a fixed provider is onePROVIDERSentry plus its host in the two packaged policies (only needed for allowlist modes). README has a section on this.Flag changes (0.4.0)
--remote-install-codex PATH→--bundle-script NAME=PATH(repeatable, agent-agnostic)--bedrock-region→--model-region--provider openai-compatible --model-base-url URL --model-key-env NAMEapi.openai.comadded tomodel_hostsin both packaged policiesVerification
pytest -q: 62 passed (55 + 7 intests/test_agents_providers.py)ruff check,ruff format --check,check_public_tree.py,actionlint,uv build,twine checkpasscybergym-e2e-dind:recipe-3b3d5f9d827b70b3); templates.py is untouched🤖 Generated with Claude Code