Publish `RenderSandbox` fields in the agent spec schema

Merged
AD
1mo ago
+55-0

The agent spec JSON schema lists no fields for RenderSandbox. It only offers the bare name, so a validator or editor using the schema rejects a spec that sets working_dir, even though that spec loads and runs. Generating the schema on main showed this.

The cause is its client field. It imports the client type at runtime, so the __init__ hints resolve, but Pydantic cannot produce a JSON schema for that class, so the form with the fields is left out.

OpenSandbox and ModalSandbox avoid this with an explicit from_spec, as the AbstractCapability.from_spec docstring recommends, and #12500 does the same for E2BSandbox. This adds one here:

  • It lists the capability's fields except client, as a client isn't data. Python code still passes client to the constructor.
  • defer_loading stays in the signature, so a spec that sets it to false still loads.
  • A spec that sets client is now refused when it loads, instead of being accepted.

Testing: one test checks the fields in the schema and another that from_spec forwards them. I ran only these locally, and CI covers the rest.

Checklist

šŸ¤– Generated with Claude Code


Summary by cubic

Adds an explicit from_spec to RenderSandbox so the agent spec JSON schema lists its fields — working_dir, env, sandbox_timeout, and so on — instead of only the bare capability name, which caused validators to reject valid specs.

  • A spec that sets client is now refused when it loads, instead of being silently accepted; Python code still passes client to the constructor.
  • defer_loading stays in the signature, so specs that set it to false still load.