Skip to main content

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), with a real interactive PTY (tty=True) and write_stdin for a running session
  • 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

Docker-volume-mount manifests are not implemented: 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

InisSandboxSession.exec() returns InisExecResult, a plain subclass of upstream's agents.sandbox.types.ExecResult adding one field:

result = await sandbox_session.exec("some-command-that-produces-a-lot-of-output")
result.truncated  # bool — set when inis.run's own per-stream capture limit cut a stream

stdout/stderr are returned exactly as inis.run produced them — no marker text, nothing to parse out. truncated is copied straight from inis.run's own trusted signal (never derived from stream content), so it can't be spoofed by anything the sandboxed command prints. An earlier version of this adapter appended a marker with a random per-call nonce to stderr instead, implying a caller could tell a real marker from a guest printing a fake one by checking the nonce; nothing ever checked it, so that implication was false.

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.

Metadata

Release files for inis-openai-agents 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inis-openai-agents 0.2.0
File Size Uploaded
inis_openai_agents-0.2.0.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inis-openai-agents 0.2.0
File Interpreter ABI Platform
inis_openai_agents-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / inis_openai_agents-0.2.0.tar.gz

Download URL inis_openai_agents-0.2.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
008bbb6e04e991753c864030322beb46d81db8ab3dc300ef55907f12d3692f10
BLAKE2b-256 checksum
How to use checksums
dca7e025fbad981c454b65514c9746c79c9b42e7f630361db121b18195d2d268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / inis_openai_agents-0.2.0-py3-none-any.whl

Download URL inis_openai_agents-0.2.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e42960e6b7b78bced4458bd6b0e2fad349ee3ff64a1b4f6deff4f71ee1212a3c
BLAKE2b-256 checksum
How to use checksums
930fd11d0f00e29e095e729ec5189e0c37aab3433caff09b27f7b5fa0646dd81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page