Skip to main content

inis.run sandbox provider for the OpenAI Agents SDK (beta)

Project description

inis-openai-agents

Native inis.run sandbox provider for the OpenAI Agents SDK SandboxAgent path (agents.sandbox).

PyPI License: MIT Python

Beta, upstream and here. The OpenAI Agents SDK documents its own sandbox surface as beta. Verified against openai-agents==0.19.1.

Install

pip install inis-openai-agents

Quickstart: attached (recommended)

One inis.run session for the whole conversation, owned by your app:

from inis import AsyncClient
from agents import Runner, RunConfig
from agents.run_config import SandboxRunConfig
from agents.sandbox import SandboxAgent
from inis_openai_agents import InisSandboxSession

client = AsyncClient()
inis_session = await client.sessions.create(egress_default="deny")
sandbox_session = InisSandboxSession.wrap(inis_session)

agent = SandboxAgent(name="assistant", model="gpt-5.1")
run_config = RunConfig(sandbox=SandboxRunConfig(session=sandbox_session))
try:
    result = await Runner.run(agent, "list files in /workspace", run_config=run_config)
    result2 = await Runner.run(agent, "now write hello.txt", run_config=run_config)
finally:
    await inis_session.destroy()  # this app owns the session; the SDK never will

The Agents SDK's own sandbox runtime never destroys a session passed via RunConfig.sandbox.session — that lifecycle stays entirely host-controlled: one persistent session across a whole conversation, not one sandbox per model turn.

Owned: one Runner.run() call at a time

from agents.run_config import SandboxRunConfig
from inis_openai_agents import InisSandboxClient, InisSandboxClientOptions

run_config = RunConfig(
    sandbox=SandboxRunConfig(
        client=InisSandboxClient(),
        options=InisSandboxClientOptions(egress_default="deny"),
    )
)
result = await Runner.run(agent, "...", run_config=run_config)

The SDK creates a fresh session for that call and destroys it unconditionally when the call ends. To resume a conversation in a later process, pass result._sandbox_resume_state back in — the SDK creates a new session and restores the workspace from a tar snapshot; it does not reattach to the original session ID. Prefer the attached path above for a real multi-turn agent.

What it does

  • exec_command (shell)
  • File read/write, symlink-safe path validation
  • Exposed ports, via session.expose()
  • Owned/attached lifetime split — see above
  • Snapshot persist/hydrate (owned path's resume) — tar+base64 over exec()

Notes

PTY is not implemented: supports_pty() stays False. Docker-volume-mount manifests are not implemented either: supports_docker_volume_mounts() stays False. True remote cancellation of an in-flight exec() is not implemented — the sandbox ABC's exec() is timeout-only, with no abort handle. A timeout still ends the call.

Truncated output

When inis.run's own per-stream capture limit truncates a command's output, exec() appends a marker to stderr rather than silently dropping the fact:

[inis: output truncated by the sandbox's own capture limit (nonce=<16 hex chars>)]

The nonce is fresh per call, so a caller parsing stderr exactly can't be fooled by sandboxed code printing a fake marker.

Fallback: plain function tools

Not using SandboxAgent? Use an ordinary Agent with function tools against inis directly — see the core inis SDK's own examples.

Development

pip install -e ".[dev]"
pip install -e ../python           # inis core SDK, editable
pytest

Links

Built and run in the EU. Your code and data never leave Europe.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inis_openai_agents-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inis_openai_agents-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file inis_openai_agents-0.1.0.tar.gz.

File metadata

  • Download URL: inis_openai_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for inis_openai_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f3a3ae7fa73777e9cdc9dabb70a19408838db02403c6ad9bc63163790738af0
MD5 e927a900c910916e2b8931a008a582df
BLAKE2b-256 7c01ca12ab04fd8e01789bc7c0db5f4229e82ed27f28200ea62262974e474b04

See more details on using hashes here.

Provenance

The following attestation bundles were made for inis_openai_agents-0.1.0.tar.gz:

Publisher: sdk-openai-agents-python-publish.yml on 4ver/inis.run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inis_openai_agents-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for inis_openai_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9728fb152c6a4352d8e10ece2be1571a1289bfae293e4dfac0af34691356c09a
MD5 3e89c70004af857166f30c37e01ecc9d
BLAKE2b-256 c890cdae39c86e6f9a37a13a41e776f3ef2070956d9aadffc90447eabc81793f

See more details on using hashes here.

Provenance

The following attestation bundles were made for inis_openai_agents-0.1.0-py3-none-any.whl:

Publisher: sdk-openai-agents-python-publish.yml on 4ver/inis.run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page