Skip to content

Add Declaw sandbox extension#2947

Draft
shivam-declaw wants to merge 1 commit intoopenai:mainfrom
shivam-declaw:feat/declaw-sandbox-extension
Draft

Add Declaw sandbox extension#2947
shivam-declaw wants to merge 1 commit intoopenai:mainfrom
shivam-declaw:feat/declaw-sandbox-extension

Conversation

@shivam-declaw
Copy link
Copy Markdown

@shivam-declaw shivam-declaw commented Apr 18, 2026

Summary

Wires declaw as an optional sandbox backend for the Agents SDK, matching the file layout and install shape already used by the other third-party extensions in this repo.

What declaw is: a security-first sandbox platform for AI agents. Every bash / file / PTY tool call the agent makes is dispatched through an isolated sandbox with an edge proxy that applies configurable guardrails on outbound traffic — PII redaction (with rehydration), prompt-injection detection, invisible-text stripping, per-sandbox domain allowlists, regex-based transformation rules, and audit logging. Templates cover common runtimes (python, node, code-interpreter, ai-agent, devops) so agents don't cold-start a shell with nothing installed.

Learn more: https://declaw.ai · Docs: https://docs.declaw.ai

All adapter code lives in the declaw PyPI package; this PR is a thin re-export + pip extra + docs row + smoke test.

Users pick the backend with one command:

pip install "openai-agents[declaw]"

And import the flat shape consistent with the other extensions:

from agents.extensions.sandbox import (
    DeclawSandboxClient,
    DeclawSandboxClientOptions,
)

Changes

  • src/agents/extensions/sandbox/declaw/__init__.py (new) — thin re-export of declaw.openai.
  • src/agents/extensions/sandbox/__init__.py_HAS_DECLAW block + __all__ extension matching the existing shape.
  • pyproject.tomldeclaw = ["declaw>=1.0.4"] under [project.optional-dependencies].
  • tests/extensions/test_sandbox_declaw.py (new) — 7 re-export / discriminator smoke tests.
  • examples/sandbox/extensions/declaw_runner.py (new) — minimal runnable example.
  • docs/sandbox/clients.md — one table row pointing at docs.declaw.ai.

Test plan

  • make format — 4 files formatted, no diff after.
  • make lint — ruff clean.
  • uv run mypy src/agents/extensions/sandbox/declaw/ tests/extensions/test_sandbox_declaw.py examples/sandbox/extensions/declaw_runner.py — Success.
  • uv run pytest tests/extensions/test_sandbox_declaw.py — 7 passed.
  • uv run pytest tests/extensions/ — 706 passed (unrelated runloop failures only).
  • End-to-end: fresh venv pip install "openai-agents[declaw]" → imports resolve from agents.extensions.sandbox.

Issue number

N/A — new third-party extension, following the pattern of existing [project.optional-dependencies] entries.

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Maintenance contract

The adapter source lives in the declaw package under declaw/openai/. Any breaking change on the declaw side bumps the minimum pin in this file. Reviewers only need to keep the re-export plumbing green — no declaw-specific logic in this repo.

Wires declaw as an optional sandbox backend for the Agents SDK,
matching the file layout and install shape already used by the other
third-party extensions in this repo. All adapter code lives in the
declaw PyPI package; this PR is a thin re-export + pip extra + docs
row + smoke test.

Users pick the backend with one command:

    pip install "openai-agents[declaw]"

And import the flat shape consistent with the other extensions:

    from agents.extensions.sandbox import (
        DeclawSandboxClient,
        DeclawSandboxClientOptions,
    )

Changes:
- src/agents/extensions/sandbox/declaw/__init__.py (new, thin re-export)
- src/agents/extensions/sandbox/__init__.py (+_HAS_DECLAW block + __all__ extension)
- pyproject.toml (new [project.optional-dependencies] entry: declaw>=1.0.4)
- tests/extensions/test_sandbox_declaw.py (new, re-export / discriminator smoke)
- examples/sandbox/extensions/declaw_runner.py (new, minimal runnable example)
- docs/sandbox/clients.md (+ one table row pointing at docs.declaw.ai)

CI: the declaw test only imports when the `[declaw]` extra is
installed; declaw is pinned >=1.0.4 (already on PyPI) so the
existing extras-matrix job resolves it cleanly.

Maintenance: the adapter source lives in the declaw package under
declaw/openai/. Any breaking change on the declaw side bumps the
minimum pin in this file. Reviewers only need to keep the re-export
plumbing green — no declaw-specific logic in this repo.
@seratch seratch marked this pull request as draft April 18, 2026 23:47
@shivam-declaw shivam-declaw marked this pull request as ready for review April 18, 2026 23:51
@seratch
Copy link
Copy Markdown
Member

seratch commented Apr 18, 2026

HI, thanks for sending this patch! It seems your own module already enables developers to use your sandbox along with this SDK. Please encourage using it for your users for now.

@seratch seratch marked this pull request as draft April 18, 2026 23:55
@shivam-declaw
Copy link
Copy Markdown
Author

HI, thanks for sending this patch! It seems your own module already enables developers to use your sandbox along with this SDK. Please encourage using it for your users for now.

Thanks for taking a look!

Our SDK does cover the direct path, and we'll keep pointing users there for now. The reason for this PR is just consistency: every other hosted backend in docs/sandbox/clients.md installs as
openai-agents[<name>] and imports from agents.extensions.sandbox. Declaw is the only one that requires a different install form.

The PR is ~30 lines of re-export wiring + 7 smoke tests — all the adapter logic stays in the declaw PyPI package, so no declaw-specific code for you to maintain. CI is self-contained: the test file only
runs when the [declaw] extra is installed, and declaw>=1.0.4 is already on PyPI.

If this merges, we'll deprecate the declaw[openai-agents] extra on our side and update our docs to steer everyone through pip install "openai-agents[declaw]" — so there's one canonical path, not two
competing ones.

Happy to follow whatever process you prefer here — is there a design doc / proposal you'd like us to open first, or a specific reviewer who owns this extension surface? If you'd rather keep new entries
closed for now, we'll close this PR and stay on the direct path.

Thanks!

@AnandShivansh2000
Copy link
Copy Markdown

HI, thanks for sending this patch! It seems your own module already enables developers to use your sandbox along with this SDK. Please encourage using it for your users for now.

Thanks for taking a look!

Our SDK does cover the direct path, and we'll keep pointing users there for now. The reason for this PR is just consistency: every other hosted backend in docs/sandbox/clients.md installs as openai-agents[<name>] and imports from agents.extensions.sandbox. Declaw is the only one that requires a different install form.

The PR is ~30 lines of re-export wiring + 7 smoke tests — all the adapter logic stays in the declaw PyPI package, so no declaw-specific code for you to maintain. CI is self-contained: the test file only runs when the [declaw] extra is installed, and declaw>=1.0.4 is already on PyPI.

If this merges, we'll deprecate the declaw[openai-agents] extra on our side and update our docs to steer everyone through pip install "openai-agents[declaw]" — so there's one canonical path, not two competing ones.

Happy to follow whatever process you prefer here — is there a design doc / proposal you'd like us to open first, or a specific reviewer who owns this extension surface? If you'd rather keep new entries closed for now, we'll close this PR and stay on the direct path.

Thanks!

@seratch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants