Skip to main content

langchain-inis

Native inis.run sandbox backend for LangChain Deep Agents (deepagents.backends.sandbox.BaseSandbox), plus a lower-level LangGraph recipe for teams not using Deep Agents.

PyPI License: MIT Python

Beta. Verified against deepagents==0.7.1 — pin langchain-inis and re-check before assuming it tracks a later deepagents major without changes.

Install

pip install langchain-inis deepagents

Quickstart: native Deep Agents backend

from inis import Client
from deepagents import create_deep_agent
from langchain_inis import InisSandboxBackend

backend = InisSandboxBackend.create()  # owned: this app destroys it
try:
    agent = create_deep_agent(model="anthropic:claude-sonnet-5", backend=backend)
    result = agent.invoke({"messages": [{"role": "user", "content": "List /workspace, then write hello.txt"}]})
    print(result["messages"][-1].content)
finally:
    backend.destroy()

No custom lifecycle tools in the model prompt — passing backend=backend is the whole integration. Deep Agents auto-registers ls/read_file/write_file/edit_file/glob/grep and execute against it, all bounded.

Owned vs. attached

  • InisSandboxBackend.create(...) — a brand-new session this app owns and must backend.destroy() when done; SandboxBackendProtocol has no lifecycle hooks of its own.
  • InisSandboxBackend.attach(session_id, ...) — binds to a session this app does not own. Never destroys it; call backend.close() when done, which only releases this backend's local HTTP transport.
backend = InisSandboxBackend.attach(existing_session_id)
try:
    agent = create_deep_agent(model=..., backend=backend)
    ...
finally:
    backend.close()  # local transport only — the session is not this app's to destroy

One agent thread/conversation should map to one session — resolve session_id per thread using whatever key your app already tracks conversations by. See examples/langgraph_recipe.py's ThreadSessionStore for a worked example.

What it does

  • execute/aexecute (shell)
  • upload_files/download_files (+ async) — base64 for binary
  • Every derived file op (ls/read/write/edit/grep/glob/delete) — BaseSandbox's own defaults, unmodified
  • Owned/attached lifetime split — see above
  • Structured error mapping — InisError.code mapped onto FileOperationError literals where it matches

enable_capture_offload is False, forced — see below, this is the most important thing to read here.

Notes

True remote cancellation of an in-flight execute() is not implemented: BaseSandbox.execute(command, timeout=...) is timeout-only, with no abort hook. A timeout still ends the call. Streaming output is not implemented either — ExecuteResponse has no streaming shape.

Large execute() output is not capped on this backend

deepagents' automatic eviction of oversized tool results (/large_tool_results) requires writing to a directory hardcoded off the filesystem root — which fails Permission denied on inis.run's non-root, /workspace-confined session, and deepagents silently keeps the full-size message rather than raising. enable_capture_offload=False reflects that this eviction path is a no-op here, not a preference.

The practical ceiling is instead inis.run's own guest-side capture cap (up to 4 MiB per stream), well past what Deep Agents' ~80 KB budget assumes. Nothing is silently dropped — the risk is an unexpectedly large chunk of context from one verbose command. Bound noisy commands yourself (head -c/tail -c, or write to a file and read_file back a slice) until deepagents supports a configurable offload root for a plain BaseSandbox.

ExecuteResponse.truncated is set directly from inis.run's own per-stream truncation signal, so a caller reading it gets an honest answer.

LangGraph recipe (lower-level, secondary path)

examples/langgraph_recipe.py is a complete, runnable example using plain LangGraph primitives (@tool, ToolNode, StateGraph) for teams not using Deep Agents. One session per graph thread ID, a bounded tool surface, and a small file-backed ThreadSessionStore demonstrating a session ID surviving a process restart.

python examples/langgraph_recipe.py           # creates (or reattaches to) demo-thread-1
python examples/langgraph_recipe.py --end      # ... and cleans it up

Development

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

Tests subclass the upstream SandboxIntegrationTests conformance suite (langchain-tests) against a fake local-subprocess inis.run HTTP backend — the network transport is faked, execute()/file ops run for real. Run on Linux (or Linux CI); several conformance tests assume GNU grep semantics that a default macOS shell doesn't have.

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

License

MIT — see LICENSE.

Metadata

Release files for langchain-inis 0.3.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 langchain-inis 0.3.0
File Size Uploaded
langchain_inis-0.3.0.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-inis 0.3.0
File Interpreter ABI Platform
langchain_inis-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / langchain_inis-0.3.0.tar.gz

Download URL langchain_inis-0.3.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fdc024d5440f598e66275bac6974f2b30f06c50a45b1bb013f3b812dc589c4e9
BLAKE2b-256 checksum
How to use checksums
ff654ff5c73513be1e255e7d455a5ee234cb1d974438f440f59966a1b46402e5
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 26, 2026.

Transparency log

Release files / langchain_inis-0.3.0-py3-none-any.whl

Download URL langchain_inis-0.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f22febe29d3d4c90c7355f71cc4e15b3a0e9f9b4774c4a8a77a55ad492375e47
BLAKE2b-256 checksum
How to use checksums
c836b331bf3336e96adb26d73f93f97449f2093ca779e9b5331e025e0f6a33c9
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 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

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