Reference
Agents
claude_code
Claude Code agent.
Agent that uses Claude Code running in a sandbox.
The agent can either use a version of Claude Code installed in the sandbox, or can download a version and install it in the sandbox (see docs on version option below for details).
Use tools to restrict Claude Code to a fixed set of built-in tools, and disallowed_tools to deny individual tools. See Tools available to Claude for the list of built-in tools.
Use the attempts option to enable additional submissions if the initial submission(s) are incorrect (by default, no additional attempts are permitted).
def claude_code(
name: str = ...,
description: str = ...,
system_prompt: str | None = ...,
skills: Sequence[str | Path | Skill] | None = ...,
mcp_servers: Sequence[MCPServerConfig] | None = ...,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = ...,
mcp_ready_timeout: float = ...,
disallowed_tools: list[str] | None = ...,
centaur: bool | CentaurOptions = ...,
attempts: int | AgentAttempts = ...,
model: str | None = ...,
model_config: str | None = ...,
effort: ClaudeCodeEffort | None = ...,
model_aliases: dict[str, str | Model] | None = ...,
transparent_proxy: bool = ...,
opus_model: str | None = ...,
sonnet_model: str | None = ...,
haiku_model: str | None = ...,
subagent_model: str | None = ...,
filter: GenerateFilter | None = ...,
permission_mode: ClaudeCodePermissionMode | None = ...,
retry_refusals: int | None = ...,
retry_uncaught_errors: int | None = ...,
cwd: str | None = ...,
env: dict[str, str] | None = ...,
user: str | None = ...,
sandbox: str | None = ...,
version: Literal['auto', 'sandbox', 'stable', 'latest'] | str = ...,
debug: bool | None = ...,
replace_system_prompt: str | None = ...,
allowlist_mcp_tools: bool = ...,
allowlist_bridged_tools: bool = ...,
tools: list[str] | None = ...,
strict_mcp_config: bool = ...,
*,
auto_mode: bool = ...,
) -> Agentnamestr-
Agent name (used in multi-agent systems with
as_tool()andhandoff()) descriptionstr-
Agent description (used in multi-agent systems with
as_tool()andhandoff()) system_promptstr | None-
Additional instructions to append to Claude Code’s built-in system prompt.
skillsSequence[str | Path | Skill] | None-
Additional skills to make available to the agent.
mcp_serversSequence[MCPServerConfig] | None-
MCP servers to make available to the agent.
bridged_toolsSequence[Tool | BridgedToolsSpec] | None-
Host-side Inspect tools to expose to the agent via MCP. Each BridgedToolsSpec creates an MCP server that makes the specified tools available to the agent running in the sandbox. Plain Tools are grouped into one MCP server named
tools. mcp_ready_timeoutfloat-
Seconds to wait for bridged MCP endpoints to serve tools before the agent launch errors.
disallowed_toolslist[str] | None-
List of tool names to disallow entirely (disallowing
"WebSearch"also disables web search for the agent). centaurbool | CentaurOptions-
Run in ‘centaur’ mode, which makes Claude Code available to an Inspect
human_cli()agent rather than running it unattended. attemptsint | AgentAttempts-
Configure agent to make multiple attempts. When this is specified, the task will be scored when the agent stops calling tools. If the scoring is successful, execution will stop. Otherwise, the agent will be prompted to pick up where it left off for another attempt.
modelstr | None-
Model name to use for Opus and Sonnet calls (defaults to main model for task).
model_configstr | None-
Model id used to select the identity Claude Code presents to itself (its “You are powered by the model …” system prompt) and any model-gated client behavior. Defaults to
None, which derives it from the real served model so the presented identity matches what’s actually running. Purely the displayed identity — calls are still bridged to the served Inspect model regardless. (Claude Code renders the genuine name/cutoff for recognized Anthropic ids and shows other ids verbatim.) effortClaudeCodeEffort | None-
Reasoning effort for the served model. Sets
GenerateConfig.reasoning_efforton the model backing this agent (seeresolve_claude_code_models), not a Claude Code CLI flag: the bridge drops request-level generation config from the inner agent by default, so passing this through the CLI would have no effect on the model actually serving the request.Noneleaves the model’s own default effort in place. model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances or model name strings. Allows using custom Model implementations (e.g., wrapped Agents) instead of standard models. When a model name in the mapping is referenced, the corresponding Model/string is used.
transparent_proxybool-
Forward the client’s generation parameters as authoritative instead of merging in the eval’s active
GenerateConfig(defaults toFalse). Claude Code’s auto-mode security classifier makes its own internal model call underpermission_mode="auto", and by default the classifier’s own generation parameters (e.g.max_tokens) are dropped in favor of the eval’sGenerateConfig. The classifier’s model identity is unaffected either way – it already resolves through the presented-identity/role aliases above (or the fallback model, for any identity not covered by those), the same as every other bridged request. opus_modelstr | None-
The model to use for
opus, or foropusplanwhen Plan Mode is active. Defaults tomodel. sonnet_modelstr | None-
The model to use for
sonnet, or foropusplanwhen Plan Mode is not active. Defaults tomodel. haiku_modelstr | None-
The model to use for haiku, or background functionality. Defaults to
model. subagent_modelstr | None-
The model to use for subagents. Defaults to
model. filterGenerateFilter | None-
Filter for intercepting bridged model requests.
permission_modeClaudeCodePermissionMode | None-
Claude Code
--permission-mode. The complete CLI set is"acceptEdits","auto","bypassPermissions","default","dontAsk", and"plan"."bypassPermissions"is near-equivalent to the default--dangerously-skip-permissionspath, and"dontAsk"is also now reachable.--allowed-toolsis consulted in every mode except"bypassPermissions". In unattended runs, tools excluded from--allowed-toolscannot be prompted for and are denied;"auto"is the only mode where otherwise-unapproved calls are adjudicated by Claude Code’s first-party classifier rather than denied unconditionally. retry_refusalsint | None-
Should refusals be retried? Defaults to retrying up to 3 times.
retry_uncaught_errorsint | None-
Should uncaught errors (unexpected crashes of Claude Code) be retried. Defaults to retrying up to 3 times.
cwdstr | None-
Working directory to run claude code within.
envdict[str, str] | None-
Environment variables to set for claude code. Applied last, so they override the sandbox defaults inspect_swe sets (see
_claude_code/env.py); e.g.CLAUDE_CODE_DISABLE_AUTO_MEMORY="0"re-enables auto-memory. userstr | None-
User to execute claude code with. Inside a sandbox identity scope (such as inspect_swarm’s users isolation), claude code runs as the scope’s user, in the scope’s working directory unless
cwdis set, andcentaurmode raises an error. sandboxstr | None-
Optional sandbox environment name.
versionLiteral['auto', 'sandbox', 'stable', 'latest'] | str-
Version of claude code to use. One of: - “auto”: Use any available version of claude code in the sandbox, otherwise download the current stable version. - “sandbox”: Use the version of claude code in the sandbox (raises
RuntimeErrorif claude is not available in the sandbox) - “stable”: Download and use the current stable version of claude code. - “latest”: Download and use the very latest version of claude code. - “x.x.x”: Download and use a specific version of claude code. Inside a sandbox identity scope, “auto” downloads a verified copy rather than using one found in the sandbox, and “sandbox” raises an error. debugbool | None-
Add
--debugcli flag and trace all debug output. replace_system_promptstr | None-
System prompt that replaces Claude Code’s built-in system prompt. Cannot be combined with
system_prompt. allowlist_mcp_toolsbool-
Whether to add static caller-provided MCP tools to
--allowed-tools(defaultTrue). It matters in every permission mode except"bypassPermissions": in unattended runs, excluded static tools are denied without prompting. SetFalsewithpermission_mode="auto"when Claude Code’s first-party classifier should adjudicate those tools. Bridged Inspect tools are governed separately byallowlist_bridged_tools. allowlist_bridged_toolsbool-
Whether to add bridged Inspect tools to
--allowed-tools(defaultTrue, preserving the behavior every existing caller gets). Bridged tools are allowlisted by default because an evaluation may depend on them being callable, and in every mode except"auto"a tool left off--allowed-toolsis denied without prompting in an unattended run.Set
FalseONLY withpermission_mode="auto", where an excluded tool is adjudicated by the classifier rather than denied. This is required for an evaluation that measures Claude Code’s own auto-mode classifier acting on bridged tools: an allow rule resolves at step 1 of the permission flow, BEFORE the classifier, so an allowlisted bridged call is never reviewed. LeftTrueunder"auto", a run whose entire tool surface is bridged produces ZERO adjudications and looks clean while being wholly unreviewed. toolslist[str] | None-
Built-in tools to make available (Claude Code
--tools).Nonekeeps Claude Code’s default tool set, a list restricts the session to those tools, and[]removes every built-in tool so that only MCP tools (e.g.bridged_tools) remain. Leaving"WebSearch"out of the list also disables web search. strict_mcp_configbool-
Only use the MCP servers passed via
mcp_serversandbridged_tools(Claude Code--strict-mcp-config), ignoring any other MCP configuration present in the sandbox. auto_modebool
codex_cli
Codex CLI.
Agent that uses OpenAI Codex CLI running in a sandbox.
Image content in the input is written to files in the sandbox and attached to the prompt via codex exec --image (requires a codex version that supports the --image option).
Use the attempts option to enable additional submissions if the initial submission(s) are incorrect (by default, no additional attempts are permitted).
def codex_cli(
name: str = ...,
description: str = ...,
system_prompt: str | None = ...,
model_config: str | None = ...,
skills: Sequence[str | Path | Skill] | None = ...,
mcp_servers: Sequence[MCPServerConfig] | None = ...,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = ...,
mcp_ready_timeout: float = ...,
mcp_startup_timeout: int | None = ...,
web_search: CodexWebSearch = ...,
goals: bool = ...,
auto_review: bool | CodexAutoReview = ...,
centaur: bool | CentaurOptions = ...,
attempts: int | AgentAttempts = ...,
model: str | None = ...,
model_aliases: dict[str, str | Model] | None = ...,
transparent_proxy: bool = ...,
filter: GenerateFilter | None = ...,
retry_refusals: int | None = ...,
home_dir: str | None = ...,
cwd: str | None = ...,
env: dict[str, str] | None = ...,
user: str | None = ...,
sandbox: str | None = ...,
version: Literal['auto', 'sandbox', 'latest'] | str = ...,
config_overrides: dict[str, str] | None = ...,
debug: bool | None = ...,
sandbox_mode: CodexSandboxMode = ...,
approval_policy: CodexApprovalPolicy = ...,
network_access: bool = ...,
approve_static_mcp_tools: bool = ...,
*,
disallowed_tools: list[Literal['web_search']] | None = ...,
) -> Agentnamestr-
Agent name (used in multi-agent systems with
as_tool()andhandoff()) descriptionstr-
Agent description (used in multi-agent systems with
as_tool()andhandoff()) system_promptstr | None-
Additional system prompt to append to default system prompt.
model_configstr | None-
Codex model slug used to select the system prompt and tool set. Defaults to
None, which derives the slug from the real model so Codex’s prompt/tooling aligns with what’s actually running. The slug comes from themodel_catalog_jsonfile inconfig_overrideswhen set (a plain absolute path in the sandbox, optionally quoted, with no escapes), else from the installed release’s catalog. Pass an explicit slug to override. skillsSequence[str | Path | Skill] | None-
Additional skills to make available to the agent.
mcp_serversSequence[MCPServerConfig] | None-
MCP servers to make available to the agent.
bridged_toolsSequence[Tool | BridgedToolsSpec] | None-
Host-side Inspect tools to expose to the agent via MCP. Each BridgedToolsSpec creates an MCP server that makes the specified tools available to the agent running in the sandbox. Plain Tools are grouped into one MCP server named
tools. In Codex code mode (models whose catalog entry setstool_mode = "code_mode_only") the model calls these tools from code it writes rather than proposing each call, so the agent raises before launch unless each spec setsrequire_proposal=False. The check is skipped whenconfig_overridessetsfeatures,model_catalog_jsonorprofilekeys. mcp_ready_timeoutfloat-
Seconds to wait for bridged MCP endpoints to serve tools before the agent launch errors.
mcp_startup_timeoutint | None-
Seconds Codex waits for bridged MCP server startup. Defaults to 300; pass
Noneto use Codex’s default. web_searchCodexWebSearch-
Web search mode. Use “live” for live web search, “cached” for cached web search, or “disabled” to disable web search. Defaults to “live”.
goalsbool-
Enable Codex goal tools (defaults to
True). auto_reviewbool | CodexAutoReview-
Enable Codex automated approval review (guardian). When enabled, Codex runs with its own sandbox active (
workspace-write) andon-requestapprovals; escalation requests (e.g. writes outside the workspace) are adjudicated by a guardian model rather than auto-approved. Thenetwork_accesssetting still applies, since that effective mode isworkspace-write. PassCodexAutoReviewto customize the guardian policy and model. Requires Codex CLI >= 0.137.0. Defaults toFalse. centaurbool | CentaurOptions-
Run in ‘centaur’ mode, which makes Codex CLI available to an Inspect
human_cli()agent rather than running it unattended. attemptsint | AgentAttempts-
Configure agent to make multiple attempts. When this is specified, the task will be scored when the agent stops calling tools. If the scoring is successful, execution will stop. Otherwise, the agent will be prompted to pick up where it left off for another attempt.
modelstr | None-
Model name to use (defaults to main model for task).
model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances or model name strings. Allows using custom Model implementations (e.g., wrapped Agents) instead of standard models. When a model name in the mapping is referenced, the corresponding Model/string is used.
transparent_proxybool-
Bind the
auto_reviewguardian slug (codex-auto-review) to the real target model even whenauto_reviewdoesn’t configure its ownmodel, and forward the client’s generation parameters as authoritative instead of merging in the eval’s activeGenerateConfig(defaults toFalse). Codex hardcodes that guardian slug into every reviewer request regardless of configuration, so without this the request has no alias, falls through to the session model instead of the intended guardian, and the guardian’s own generation parameters (e.g.max_tokens) are dropped. Required forauto_review=Truewithapproval_policy="on-request"when no explicitCodexAutoReview(model=...)is set. The ordinary bridged request (Codex’s own--modelslug) is unaffected – it keeps resolving to the real target model exactly as it does withtransparent_proxy=False. filterGenerateFilter | None-
Filter for intercepting bridged model requests.
retry_refusalsint | None-
Should refusals be retried? (pass number of times to retry)
home_dirstr | None-
Home directory to use for codex cli. If set, AGENTS.md, skills, and the MCP configuration will be written here. Inside a sandbox identity scope it must expand to an absolute path (such as
~/.codex); a relative one raises an error. cwdstr | None-
Working directory to run codex cli within.
envdict[str, str] | None-
Environment variables to set for codex cli
userstr | None-
User to execute codex cli with. Inside a sandbox identity scope (such as inspect_swarm’s users isolation), codex cli runs as the scope’s user, in the scope’s working directory unless
cwdis set, andcentaurmode raises an error. sandboxstr | None-
Optional sandbox environment name.
versionLiteral['auto', 'sandbox', 'latest'] | str-
Version of codex cli to use. One of: - “auto”: Use any available version of codex cli in the sandbox, otherwise download the latest version. - “sandbox”: Use the version of codex cli in the sandbox (raises
RuntimeErrorif codex is not available in the sandbox) - “latest”: Download and use the very latest version of codex cli. - “x.x.x”: Download and use a specific version of codex cli. Inside a sandbox identity scope, “auto” downloads a verified copy rather than using one found in the sandbox, and “sandbox” raises an error. config_overridesdict[str, str] | None-
Additional Codex CLI configuration overrides. Each key-value pair is passed as
-c key=valueto the CLI, exceptapproval_policyandsandbox_mode, which are intercepted and validated (invalid values raiseValueError) so that command construction and the bridged-MCP configuration are derived from one effective value rather than silently disagreeing with the raw flag. debugbool | None-
Trace all debug output.
sandbox_modeCodexSandboxMode-
Codex’s own sandbox policy for model-generated shell commands (
-s/--sandbox), not related to thesandboxoption above that selects an Inspect sandbox environment. Defaults to"danger-full-access", which combined withapproval_policy="never"(the default) reproduces the original--dangerously-bypass-approvals-and-sandboxbehavior.The restricted modes run Codex’s Linux sandbox, which on current codex releases requires a system
bwrap(bubblewrap) binary in the sandbox image – the codex release archive ships only the codex binary, so no bundled fallback exists, and codex panics at shell launch without it (this agent fails fast with an actionable error instead). The container runtime must also permit unprivileged user namespace creation; Docker’s default seccomp profile does not. The mechanism is version-dependent: codex <= 0.77 used Landlock+seccomp (no bwrap), 0.98 had bwrap opt-in.Mode semantics for model-generated commands (the Codex parent process contacts MCP servers and the model proxy outside this sandbox):
"read-only"blocks writes AND network, and with the defaultapproval_policy="never"denies writes outright with no approval path (the agent cannot edit anything)."workspace-write"makes cwd,/tmpand$TMPDIRwritable, but remounts top-level.git(and.agents/.codex) in each writable root read-only – model-rungit commit/checkout/stashfail (flip side: the agent cannot tamper with its own.codexCODEX_HOME). approval_policyCodexApprovalPolicy-
Codex’s approval policy (
AskForApproval). Defaults to"never". Under headlesscodex exec(the default), codex itself overrides the runtime policy toneverregardless of this setting (verified on codex 0.42.0 through 0.145.0), so a non-"never"value without an approvals reviewer raisesValueErrorhere rather than silently breaking bridged tools. Prompting policies are effective in centaur mode, or headless withconfig_overrides={"approvals_reviewer": ...}(codex’s auto-review escape hatch). network_accessbool-
Whether Codex’s
"workspace-write"sandbox may access the network for model-generated commands. Defaults toTrue– note this inverts Codex’s own default (false) to preserve continuity with the previous unconditional full-access behavior; ignored by other sandbox modes. Applies underauto_reviewtoo, whose effective mode isworkspace-write: atTruethe sandbox grants network up front, so the guardian has no network escalation to adjudicate.config_overrides={"sandbox_workspace_write.network_access": "false"}also wins over this setting (later-cpairs take precedence in codex). approve_static_mcp_toolsbool-
Also pre-approve tool calls from static
mcp_servers(not just Inspect-bridged servers) when the effective approval policy is"never". Defaults toFalse: static servers keep Codex’s per-server default gate. Note that under the restricted sandbox modes that default cancels un-annotated static tool calls headlessly (inspect’sMCPServerConfigcannot expressdefault_tools_approval_mode), so set this toTrueif you combinesandbox_modewith staticmcp_servers. Raises if combined withauto_review=True: that macro’s effective policy is"on-request", never"never", so the override this option applies would be silently unreachable. disallowed_toolslist[Literal['web_search']] | None
gemini_cli
Gemini CLI agent.
Agent that uses Google Gemini CLI running in a sandbox with Inspect model bridging.
Use the attempts option to enable additional submissions if the initial submission(s) are incorrect (by default, no additional attempts are permitted).
@agent
def gemini_cli(
name: str = "Gemini CLI",
description: str = dedent("""
Autonomous coding agent capable of writing, testing, debugging,
and iterating on code across multiple languages.
"""),
system_prompt: str | None = None,
skills: Sequence[str | Path | Skill] | None = None,
mcp_servers: Sequence[MCPServerConfig] | None = None,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = None,
mcp_ready_timeout: float = DEFAULT_MCP_READY_TIMEOUT,
web_search: bool = True,
centaur: bool | CentaurOptions = False,
attempts: int | AgentAttempts = 1,
model: str | None = None,
model_aliases: dict[str, str | Model] | None = None,
gemini_model: str = "gemini-2.5-pro",
filter: GenerateFilter | None = None,
retry_refusals: int | None = None,
cwd: str | None = None,
env: dict[str, str] | None = None,
user: str | None = None,
sandbox: str | None = None,
version: Literal["auto", "sandbox", "stable", "latest"] | str = "auto",
debug: bool | None = None,
) -> Agentnamestr-
Agent name (used in multi-agent systems with
as_tool()andhandoff()) descriptionstr-
Agent description
system_promptstr | None-
Additional system prompt to append
skillsSequence[str | Path | Skill] | None-
Additional skills to make available to the agent.
mcp_serversSequence[MCPServerConfig] | None-
MCP servers to make available to the agent
bridged_toolsSequence[Tool | BridgedToolsSpec] | None-
Host-side Inspect tools to expose to the agent via MCP. Each BridgedToolsSpec creates an MCP server; plain Tools are grouped into one MCP server named
tools. mcp_ready_timeoutfloat-
Seconds to wait for bridged MCP endpoints to serve tools before the agent launch errors.
web_searchbool-
Enable the agent’s web search tool (defaults to
True). centaurbool | CentaurOptions-
Run in ‘centaur’ mode, which makes Gemini CLI available to an Inspect
human_cli()agent rather than running it unattended. attemptsint | AgentAttempts-
Configure agent to make multiple attempts
modelstr | None-
Model name to use for inspect bridge (defaults to main model for task)
model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances or model name strings. Allows using custom Model implementations (e.g., wrapped Agents) instead of standard models. When a model name in the mapping is referenced, the corresponding Model/string is used.
gemini_modelstr-
Gemini model name to pass to CLI. This bypasses the auto-router. Use “gemini-2.5-pro” (default) or “gemini-2.5-flash”. The actual model calls still go through the inspect bridge, but this disables the router.
filterGenerateFilter | None-
Filter for intercepting bridged model requests
retry_refusalsint | None-
Should refusals be retried? (pass number of times to retry)
cwdstr | None-
Working directory to run gemini cli within
envdict[str, str] | None-
Environment variables to set for gemini cli
userstr | None-
User to execute gemini cli with
sandboxstr | None-
Optional sandbox environment name
versionLiteral['auto', 'sandbox', 'stable', 'latest'] | str-
Version of gemini cli to use. One of: - “auto”: Use any available version in sandbox, otherwise download latest - “sandbox”: Use sandbox version (raises RuntimeError if not available) - “stable”/“latest”: Download and use the newest release that is at least 7 days old - “x.x.x”: Download and use a specific version
debugbool | None-
Trace all debug output.
opencode
OpenCode agent.
Agent that uses OpenCode running in a sandbox with Inspect model bridging.
Use the attempts option to enable additional submissions if the initial submission(s) are incorrect (by default, no additional attempts are permitted).
@agent
def opencode(
name: str = "OpenCode",
description: str = dedent("""
Open-source autonomous coding agent for the terminal, capable
of writing, testing, debugging, and iterating on code across
multiple languages.
"""),
system_prompt: str | None = None,
skills: Sequence[str | Path | Skill] | None = None,
mcp_servers: Sequence[MCPServerConfig] | None = None,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = None,
mcp_ready_timeout: float = DEFAULT_MCP_READY_TIMEOUT,
centaur: bool | CentaurOptions = False,
attempts: int | AgentAttempts = 1,
model: str | None = None,
model_aliases: dict[str, str | Model] | None = None,
opencode_model: str = "anthropic/claude-sonnet-4-6",
filter: GenerateFilter | None = None,
retry_refusals: int | None = None,
cwd: str | None = None,
env: dict[str, str] | None = None,
user: str | None = None,
sandbox: str | None = None,
version: Literal["auto", "sandbox", "stable", "latest"] | str = "auto",
debug: bool | None = None,
session_title: str | None = "Inspect eval",
) -> Agentnamestr-
Agent name (used in multi-agent systems with
as_tool()andhandoff()) descriptionstr-
Agent description
system_promptstr | None-
Additional system prompt to append
skillsSequence[str | Path | Skill] | None-
Additional skills to make available to the agent.
mcp_serversSequence[MCPServerConfig] | None-
MCP servers to make available to the agent
bridged_toolsSequence[Tool | BridgedToolsSpec] | None-
Host-side Inspect tools to expose to the agent via MCP. Each BridgedToolsSpec creates an MCP server; plain Tools are grouped into one MCP server named
tools. mcp_ready_timeoutfloat-
Seconds to wait for bridged MCP endpoints to serve tools before the agent launch errors.
centaurbool | CentaurOptions-
Run in ‘centaur’ mode, which makes OpenCode available to an Inspect
human_cli()agent rather than running it unattended. attemptsint | AgentAttempts-
Configure agent to make multiple attempts
modelstr | None-
Model name to use for inspect bridge (defaults to main model for task)
model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances or model name strings. Allows using custom Model implementations (e.g., wrapped Agents) instead of standard models. When a model name in the mapping is referenced, the corresponding Model/string is used.
opencode_modelstr-
OpenCode model identifier to pass to the CLI in the form
provider/model(default:"anthropic/claude-sonnet-4-6"). The actual model calls still go through the Inspect bridge; this just selects which provider client OpenCode uses to format the request. filterGenerateFilter | None-
Filter for intercepting bridged model requests
retry_refusalsint | None-
Should refusals be retried? (pass number of times to retry)
cwdstr | None-
Working directory to run opencode within
envdict[str, str] | None-
Environment variables to set for opencode
userstr | None-
User to execute opencode with
sandboxstr | None-
Optional sandbox environment name
versionLiteral['auto', 'sandbox', 'stable', 'latest'] | str-
Version of opencode to use. One of: - “auto”: Use any available version in sandbox, otherwise download latest - “sandbox”: Use sandbox version (raises RuntimeError if not available) - “stable”/“latest”: Download and use the latest version - “x.x.x”: Download and use a specific version The prompt is delivered on stdin, which needs opencode >= 1.14.42; earlier versions prepend a newline to piped input (only reachable with an older opencode pre-installed in the sandbox).
debugbool | None-
Trace all debug output.
session_titlestr | None-
Session title passed to
opencode run --title. Any non-default title makes opencode skip its automatic title-generation model call – an extra bridged request per session whose result a headless run never uses – so the default fixed title suppresses that call. PassNoneto restore opencode’s title generation. An empty string makes opencode use the first 50 characters of the prompt as the title (also without a model call).
mini_swe_agent
mini-swe-agent agent.
Agent that uses mini-swe-agent running in a sandbox. Mini-swe-agent is a minimal 100-line agent that solves GitHub issues using only bash commands.
The agent can either use a version of mini-swe-agent installed in the sandbox, or can download and install it via pip (see docs on version option below).
Use attempts to enable additional submissions if initial submission(s) are incorrect (by default, no additional attempts are permitted).
This agent does not handle compaction natively. Use compaction to specify a compaction strategy.
@agent
def mini_swe_agent(
name: str = "mini-swe-agent",
description: str = dedent("""
Minimal AI agent that solves software engineering tasks using bash commands.
100 lines of Python, radically simple, scores >74% on SWE-bench verified.
"""),
system_prompt: str | None = None,
centaur: bool | CentaurOptions = False,
attempts: int | AgentAttempts = 1,
model: str | None = None,
model_aliases: dict[str, str | Model] | None = None,
filter: GenerateFilter | None = None,
retry_refusals: int | None = None,
compaction: CompactionStrategy | None = None,
cwd: str | None = None,
env: dict[str, str] | None = None,
user: str | None = None,
sandbox: str | None = None,
version: Literal["stable", "sandbox", "latest"] | str = "stable",
debug: bool | None = None,
) -> Agentnamestr-
Agent name (used in multi-agent systems with
as_tool()andhandoff()) descriptionstr-
Agent description (used in multi-agent systems)
system_promptstr | None-
Additional system prompt to include (appended to any system messages from the task).
centaurbool | CentaurOptions-
Run in ‘centaur’ mode, which makes mini-swe-agent available to an Inspect
human_cli()agent rather than running it unattended. attemptsint | AgentAttempts-
Configure agent to make multiple attempts.
modelstr | None-
Model name to use (defaults to main model for task).
model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances or model name strings. Allows using custom Model implementations (e.g., wrapped Agents) instead of standard models. When a model name in the mapping is referenced, the corresponding Model/string is used.
filterGenerateFilter | None-
Filter for intercepting bridged model requests.
retry_refusalsint | None-
Should refusals be retried? (pass number of times to retry)
compactionCompactionStrategy | None-
Compaction strategy for managing context window overflow.
cwdstr | None-
Working directory to run mini-swe-agent within.
envdict[str, str] | None-
Environment variables to set for mini-swe-agent.
userstr | None-
User to execute mini-swe-agent with.
sandboxstr | None-
Optional sandbox environment name.
versionLiteral['stable', 'sandbox', 'latest'] | str-
Version of mini-swe-agent to use. One of: - “stable”: Download and install the default pinned version. - “sandbox”: Use version in sandbox (raises RuntimeError if not available) - “latest”: Download and install latest version from PyPI. - “x.x.x”: Install and use a specific version.
debugbool | None-
Trace all debug output.
antigravity
Google Antigravity SDK agent.
Runs Google’s Antigravity SDK (google-antigravity, which bundles the localharness engine) headless inside an Inspect sandbox, with model calls routed through the sandbox agent bridge. The SDK’s native connection speaks the Gemini generateContent wire directly to the bridge via a GeminiAPIEndpoint base_url override (no OpenAI translation), mirroring gemini_cli.
@agent
def antigravity(
name: str = "Antigravity",
description: str = "Sandboxed Google Antigravity SDK coding agent.",
system_prompt: str | None = None,
mcp_servers: Sequence[MCPServerConfig] | None = None,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = None,
mcp_ready_timeout: float = DEFAULT_MCP_READY_TIMEOUT,
model: str | None = None,
model_aliases: dict[str, str | Model] | None = None,
filter: _ModelGenerateFilter | None = None,
retry_refusals: int | None = None,
user: str | None = None,
cwd: str | None = None,
sandbox: str | None = None,
version: str = "0.1.7",
endpoint_model: str = _DEFAULT_ENDPOINT_MODEL,
debug: bool | None = None,
) -> Agentnamestr-
Agent name.
descriptionstr-
Agent description.
system_promptstr | None-
Additional system prompt to append.
mcp_serversSequence[MCPServerConfig] | None-
MCP servers to make available to the agent (HTTP configs; localharness reaches servers over streamable HTTP).
bridged_toolsSequence[Tool | BridgedToolsSpec] | None-
Host-side Inspect tools to expose to the agent via MCP. Each BridgedToolsSpec creates an MCP server; plain Tools are grouped into one MCP server named
tools. mcp_ready_timeoutfloat-
Seconds to wait for bridged MCP endpoints to serve tools before the agent launch errors.
modelstr | None-
Model name to use for the inspect bridge (defaults to the task model).
model_aliasesdict[str, str | Model] | None-
Optional mapping of model names to Model instances/strings. Alias keys resolve against the client-sent model name, which for this agent is
endpoint_model. filter_ModelGenerateFilter | None-
Filter for intercepting bridged model requests. Note this agent’s filter is typed Model-first (the non-deprecated GenerateFilter form); the deprecated str-first form is not accepted, unlike sibling agents, because the confinement wrapper invokes the user filter Model-first directly, with no legacy-dispatch branching of its own.
retry_refusalsint | None-
Should refusals be retried? (pass number of times to retry)
userstr | None-
Sandbox user to run the SDK as (defaults to the sandbox default user).
cwdstr | None-
Working directory for the SDK (defaults to the user’s home directory).
sandboxstr | None-
Optional sandbox environment name.
versionstr-
Version of the google-antigravity SDK to provision when it is not already present in the sandbox image.
endpoint_modelstr-
Model name the SDK client presents to the bridge endpoint.
debugbool | None-
Trace the full runner output.
Binaries
download_agent_binary
Download agent binary.
Download an agent binary. This version will be added to the cache of downloaded versions (which retains the 5 most recently downloaded versions).
Use this if you need to ensure that a specific version of an agent binary is downloaded in advance (e.g. if you are going to run your evaluations offline). After downloading, explicit requests for the downloaded version (e.g. claude_code(version="1.0.98")) will not require network access.
def download_agent_binary(
binary: Literal["claude_code", "codex_cli", "kimi_code", "opencode"],
version: Literal["stable", "latest"] | str,
platform: SandboxPlatform,
) -> NonebinaryLiteral['claude_code', 'codex_cli', 'kimi_code', 'opencode']-
Type of binary to download
versionLiteral['stable', 'latest'] | str-
Version to download (“stable”, “latest”, or an explicit version number).
platformSandboxPlatform-
Target platform (“linux-x64”, “linux-arm64”, “linux-x64-musl”, or “linux-arm64-musl”)
cached_agent_binaries
List the agent binaries which have been cached on this system.
def cached_agent_binaries(
binary: Literal["claude_code", "codex_cli", "kimi_code", "opencode"] | None = None,
quiet: bool = False,
) -> AgentBinariesbinaryLiteral['claude_code', 'codex_cli', 'kimi_code', 'opencode'] | None-
Type of binary to list (lists all of if not specified).
quietbool-
Do not print the binaries as a side effect
resolve_agent_version
Resolve the version of an agent binary that would be installed.
Resolves “stable” or “latest” to the concrete version agent would install in this process (an explicit version number is returned unchanged). Use this to pin a version once at setup time so every sample in a run installs the same binary and the run records which version actually ran.
def resolve_agent_version(
agent: Literal["claude_code", "codex_cli", "kimi_code", "opencode"],
version: Literal["stable", "latest"] | str,
platform: SandboxPlatform = "linux-x64",
) -> stragentLiteral['claude_code', 'codex_cli', 'kimi_code', 'opencode']-
Agent whose version to resolve.
versionLiteral['stable', 'latest'] | str-
Version to resolve. “stable” and “latest” are resolved against the agent’s release manifest. Any other value is returned unchanged: an explicit version number is already concrete, and “auto” / “sandbox” refer to whatever is installed in the sandbox and cannot be resolved on the host, so they pass through for the agent function to handle at install time.
platformSandboxPlatform-
Target platform (“linux-x64”, “linux-arm64”, “linux-x64-musl”, or “linux-arm64-musl”). The version string is the same on every platform, but resolution (and its per-process cache) is per platform and consults that platform’s release manifest, which may not exist for every platform.
download_wheels_tarball
Download all wheels for a package and its dependencies.
Downloads wheels from PyPI for the specified platform and Python version, then bundles them into a tarball for offline installation in sandbox. Downloaded wheels are cached locally (retaining 5 most recent versions).
def download_wheels_tarball(
package_name: str,
version: str | None,
platform: SandboxPlatform,
python_version: str,
) -> tuple[bytes, str]package_namestr-
PyPI package name (e.g., “mini-swe-agent”)
versionstr | None-
Package version or None for latest
platformSandboxPlatform-
Target sandbox platform
python_versionstr-
Python version without dots (e.g., “312”)
AgentBinary
Agent binary.
class AgentBinary(NamedTuple)Attributes
agentLiteral['claude_code', 'codex_cli', 'kimi_code', 'opencode']-
Agent type.
versionstr-
Agent version.
pathPath-
“Agent path.
AgentBinaryInstall
Provenance of the agent binary a sample actually ran.
Recorded as the data of an InfoEvent (source="inspect_swe") each time an agent resolves its binary, so a sample that invokes two agents (or the same agent twice) carries one record per invocation. The event exists because the installed version can differ from the one the task appears to request, and can differ between samples of a single eval: "stable"/"latest" resolve through a per-process cache with no expiry, so a resumed run, an eval_set retry, or a multi-process run can install a newer release for the remaining samples, and "auto" takes whatever the sandbox image happens to contain.
class AgentBinaryInstall(BaseModel)Attributes
agentstr-
Agent the binary belongs to (e.g.
"claude_code"). requestedstr-
version=as the caller passed it:"auto","sandbox","stable","latest", or an explicit version. versionstr | None-
Concrete version installed. When
origin="sandbox"the binary was already in the image, so this is the versioncodex_clireads fromcodex --version, andNonefor the other agents, which do not run the binary to ask. platformSandboxPlatform | None-
Platform the artifact was resolved for.
Nonewhenorigin="sandbox", where no platform-specific artifact is chosen and detection would add three sandbox execs to the default path. checksumstr | None-
SHA-256 of the host-side artifact this install resolved: the binary itself, or the package archive extracted into the sandbox.
Nonewhenorigin="sandbox", where the host never reads the binary.Two caveats. It is not always the digest published upstream: an agent that transforms its download (
codex_cliextracting a single binary from a tarball on pre-rust-v0.133.0releases) installs bytes the manifest never described, while a package archive is cached and extracted verbatim and so does match when a manifest was resolved at all.And it describes the artifact on the host, not a re-read of the sandbox. When a package for this version is already extracted in the sandbox the write and extract are skipped, so the digest is of the cached archive that install came from rather than of bytes this call placed there.
originAgentBinaryOrigin-
How the binary got into the sandbox.
"download": fetched over the network and verified against the resolved digest."cache": served from the local cache. This is not a claim of verification. A pinned version read on the fast path is not checked against a digest because none is resolved for it, and neither is a cached artifact for an agent with apost_downloadtransform, whose installed bytes cannot be compared against the download digest."sandbox": already present in the image; nothing was installed."cache_unverified": resolution or download failed; the cached fallback was installed without checksum verification.
AgentBinaryOrigin
Where the agent binary a sample ran came from.
AgentBinaryOrigin: TypeAlias = Literal[
"download", "cache", "sandbox", "cache_unverified"
]SandboxPlatform
Target platform identifier for sandbox binary and wheel downloads.
SandboxPlatform: TypeAlias = Literal[
"linux-x64", "linux-arm64", "linux-x64-musl", "linux-arm64-musl"
]ACP
interactive_claude_code
Claude Code agent via ACP.
Uses the claude-agent-acp adapter in a sandbox. Supports multi-turn sessions and mid-turn interrupts.
def interactive_claude_code(
*,
disallowed_tools: list[str] | None = ...,
skills: list[str | Path | Skill] | None = ...,
opus_model: str | Model | None = ...,
sonnet_model: str | Model | None = ...,
haiku_model: str | Model | None = ...,
subagent_model: str | Model | None = ...,
model: str | Model | None = ...,
filter: GenerateFilter | None = ...,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = ...,
mcp_servers: list[MCPServerConfig] | None = ...,
system_prompt: str | None = ...,
retry_refusals: int | None = ...,
model_map: dict[str, str | Model] | None = ...,
cwd: str | None = ...,
env: dict[str, str] | None = ...,
user: str | None = ...,
sandbox: str | None = ...,
mcp_ready_timeout: float = ...,
) -> ACPAgentdisallowed_toolslist[str] | None-
Tool names to disallow.
skillslist[str | Path | Skill] | None-
Additional skills to make available.
opus_modelstr | Model | None-
Model for opus calls.
sonnet_modelstr | Model | None-
Model for sonnet calls.
haiku_modelstr | Model | None-
Model for haiku / background calls.
subagent_modelstr | Model | None-
Model for subagents.
modelstr | Model | NonefilterGenerateFilter | Nonebridged_toolsSequence[Tool | BridgedToolsSpec] | Nonemcp_serverslist[MCPServerConfig] | Nonesystem_promptstr | Noneretry_refusalsint | Nonemodel_mapdict[str, str | Model] | Nonecwdstr | Noneenvdict[str, str] | Noneuserstr | Nonesandboxstr | Nonemcp_ready_timeoutfloat
interactive_codex_cli
Codex CLI agent via ACP.
Uses the codex-acp adapter in a sandbox. Supports multi-turn sessions and mid-turn interrupts.
def interactive_codex_cli(
*,
web_search: CodexWebSearch = ...,
goals: bool = ...,
auto_review: bool | CodexAutoReview = ...,
skills: list[str | Path | Skill] | None = ...,
home_dir: str | None = ...,
config_overrides: dict[str, str] | None = ...,
disallowed_tools: list[Literal['web_search']] | None = ...,
) -> ACPAgentweb_searchCodexWebSearch-
Web search mode. Use
"live"for live web search,"cached"for cached web search, or"disabled"to disable web search. goalsbool-
Enable Codex goal tools.
auto_reviewbool | CodexAutoReview-
Enable Codex automated approval review (guardian): Codex runs with its own
workspace-writesandbox andon-requestapprovals, with escalations adjudicated by a guardian model. Pass :class:CodexAutoReviewto customize the guardian policy and model. Note: guardian adjudication depends on the codex-core embedded in thecodex-acpadapter honoringapprovals_reviewer(Codex CLI >= 0.137.0 behavior); unlike codex_cli(), this cannot be version-checked here. If the embedded core instead surfaces an escalation as an ACP permission request, it is auto-approved. skillslist[str | Path | Skill] | None-
Additional skills to make available.
home_dirstr | None-
Override for
CODEX_HOMEdirectory in the sandbox. config_overridesdict[str, str] | None-
Extra Codex config.toml key-value pairs.
disallowed_toolslist[Literal['web_search']] | None
interactive_gemini_cli
Gemini CLI agent via ACP.
Uses gemini’s native --experimental-acp flag in a sandbox. Supports multi-turn sessions and mid-turn interrupts.
def interactive_gemini_cli(
*,
skills: list[str | Path | Skill] | None = ...,
version: Literal['auto', 'sandbox', 'stable', 'latest'] | str = ...,
web_search: bool = ...,
debug: bool = ...,
model: str | Model | None = ...,
filter: GenerateFilter | None = ...,
bridged_tools: Sequence[Tool | BridgedToolsSpec] | None = ...,
mcp_servers: list[MCPServerConfig] | None = ...,
system_prompt: str | None = ...,
retry_refusals: int | None = ...,
model_map: dict[str, str | Model] | None = ...,
cwd: str | None = ...,
env: dict[str, str] | None = ...,
user: str | None = ...,
sandbox: str | None = ...,
mcp_ready_timeout: float = ...,
) -> ACPAgentskillslist[str | Path | Skill] | None-
Additional skills to make available.
versionLiteral['auto', 'sandbox', 'stable', 'latest'] | str-
Version of gemini CLI to use. One of:
"auto","sandbox","stable","latest", or a specific semver version string. web_searchbool-
Enable the agent’s web search tool (defaults to
True). debugbool-
Run gemini-cli with
--debugandGEMINI_DEBUG_LOG_FILEset to$HOME/gemini-debug.login the sandbox (in ACP mode console output is patched away from stderr, so the log file is the only way to surface internals). modelstr | Model | NonefilterGenerateFilter | Nonebridged_toolsSequence[Tool | BridgedToolsSpec] | Nonemcp_serverslist[MCPServerConfig] | Nonesystem_promptstr | Noneretry_refusalsint | Nonemodel_mapdict[str, str | Model] | Nonecwdstr | Noneenvdict[str, str] | Noneuserstr | Nonesandboxstr | Nonemcp_ready_timeoutfloat
bridge_mcp_to_acp
Convert bridge MCPServerConfigHTTP objects to ACP HttpMcpServer.
def bridge_mcp_to_acp(configs: list[MCPServerConfigHTTP]) -> list[HttpMcpServer]configslist[MCPServerConfigHTTP]
ACPAgent
Base class for ACP-based agents running in sandboxes.
Manages the ACP lifecycle (connection, session, MCP announcement, cleanup). Subclasses implement :meth:_start_agent for agent-specific setup.
Sets up the ACP lifecycle, exposes .conn and .session_id, signals .ready, then blocks until the task is cancelled. The caller drives all prompts via conn.prompt() / conn.cancel().
class ACPAgent(Agent)ACPAgentParams
Keyword arguments accepted by :class:ACPAgent.
class ACPAgentParams(TypedDict, total=False)acp_connection
Bridge an ExecRemoteProcess to ACP. Yield (conn, feeder, error_info).
Bridges ExecRemoteProcess to the SDK’s connect_to_agent() via a transport wrapper, then cleans up on exit.
feeder is a background task that reads process stdout and feeds it into the ACP reader. It completes when the process exits, so callers can await feeder to detect unexpected process termination.
proc_info collects stderr output and the exit code as the process runs. Inspect after await feeder for full diagnostics.
Usage::
async with acp_connection(proc) as (conn, feeder, proc_info):
await conn.initialize(...)
session = await conn.new_session(...)
await conn.prompt(...)
@contextlib.asynccontextmanager
async def acp_connection(
proc: ExecRemoteProcess,
) -> AsyncIterator[tuple[ClientSideConnection, asyncio.Task[None], ErrorInfo]]procExecRemoteProcess