Skip to main content

Maritime

langchain-maritime

PyPI Python versions MIT license Tests Docs Discord

Run Deep Agents on a real cloud computer from Maritime.
Every file read, edit, search and shell command happens in the agent's own Linux sandbox, never on your machine.

Quickstart · Deep Agents Code · Options · Tested · More agents on Maritime

Quickstart

pip install langchain-maritime langchain-openai
export MARITIME_API_KEY=mk_...     # maritime.sh/settings/api-keys
export OPENAI_API_KEY=sk-...
from deepagents import create_deep_agent
from langchain_openai import ChatOpenAI

from langchain_maritime import MaritimeSandbox

backend = MaritimeSandbox.create(idle_timeout_seconds=600)
try:
    agent = create_deep_agent(model=ChatOpenAI(model="gpt-5.4"), backend=backend)
    result = agent.invoke(
        {
            "messages": [
                {
                    "role": "user",
                    "content": "Write primes.py that prints 10 primes, run it, show me the output.",
                }
            ]
        }
    )
    print(result["messages"][-1].content)
finally:
    backend.kill()

MaritimeSandbox.create() starts a fresh sandbox in a few seconds. The agent's ls, read_file, write_file, edit_file, glob, grep and execute tools all run inside it.

Already have a sandbox? Wrap it:

from maritime import Maritime

sandbox = Maritime().sandboxes.get("sbx-...")
backend = MaritimeSandbox(sandbox=sandbox)

The runnable version is examples/deep_agent.py. No OpenAI account? Maritime LLM is OpenAI-compatible: set OPENAI_BASE_URL=https://api.maritime.sh/api/llm/v1 and use your Maritime LLM token as OPENAI_API_KEY.

Deep Agents Code

Installing this package adds a maritime sandbox to Deep Agents Code. No config needed:

dcode install langchain-maritime --package
export MARITIME_API_KEY=mk_...
dcode --sandbox maritime

Deep Agents Code starts a sandbox for the session, works in /home/user, and ends the sandbox when you quit. To keep working in the same machine, pass its id with --sandbox-id sbx-.... To start from a snapshot you saved, pass --sandbox-snapshot-name my-snapshot.

To set Maritime options for every session, declare the provider in ~/.deepagents/config.toml. Deep Agents Code reads params only from a declared provider, so keep the first three lines:

[sandboxes.providers.maritime]
class_path = "langchain_maritime.dcode:MaritimeProvider"
working_dir = "/home/user"
supports_snapshot_name = true

[sandboxes.providers.maritime.params]
size = "large"
idle_timeout_seconds = 3600

What the agent gets

  • Its own Linux machine. Ubuntu 24.04 with Python 3.12, Node, git and curl, 2 vCPUs, 4 GiB of memory and 12 GiB of disk by default, up to 16 vCPUs and 64 GiB.
  • Real isolation. Each sandbox is a microVM with its own kernel, filesystem, network and processes.
  • Root when it needs it. Commands run as user, with passwordless sudo for installs.
  • Limits that clean up after you. An idle timeout pauses or ends a forgotten sandbox, and time_limit_seconds ends it no matter what.

Options

MaritimeSandbox.create() takes any Maritime sandbox option:

Option Default What it does
from_ base A saved snapshot, a template, or a public image to start from.
size small A preset: small, medium, large or xlarge.
vcpu, memory_mib, disk_gib from size Override the preset.
env none Environment variables for every command.
idle_timeout_seconds Maritime's default How long without activity before on_idle applies.
on_idle pause pause keeps the disk and resumes on the next call. kill ends the sandbox.
time_limit_seconds none End the sandbox this long after it starts.
metadata none Labels you can filter on when you list sandboxes.

The backend itself takes timeout, the default seconds a command may run (30 minutes). A timeout of 0 waits as long as Maritime allows.

Behavior

  • Commands run with bash -lc. Output is stdout followed by <stderr>...</stderr> when there is any.
  • A command that runs out of time returns exit code 124 with the output it printed so far.
  • File errors use Deep Agents' codes (file_not_found, is_directory, invalid_path, permission_denied). Anything else, such as an ended sandbox or a billing limit, keeps Maritime's own message so the agent sees what really went wrong.
  • Maritime's file API acts as the machine's administrator, so download_files can read a file the shell user cannot.

Tested

The Deep Agents standard sandbox suite runs against a real Maritime sandbox:

MARITIME_API_KEY=mk_... uv run pytest -m live

On 2026-11-17, with deepagents 0.7.39, maritime 0.12 and langchain-tests 1.1.9, 77 of the 86 standard tests pass. The other 9 are marked as expected failures in conftest.py, each with its reason:

  • 7 glob and write tests: langchain-tests 1.1.9 expects relative glob paths and a write that refuses existing files, while deepagents 0.7.x returns absolute paths and overwrites. A plain local BaseSandbox fails them the same way.
  • 2 large-output tests call python, and the Maritime base image ships python3 only.

The live tests also cover the Deep Agents Code provider: create, reconnect by id, delete, and a new sandbox from a saved snapshot.

The unit tests run without an account. They swap only the network calls, so commands really run and Deep Agents' read, write, edit and ls helpers execute for real:

uv run pytest

Compatibility

Package Versions
Python 3.11 to 3.14
deepagents 0.7.34 and later 0.7.x
deepagents-code (optional) 0.2.5 and later, on Python 3.14
maritime 0.11.x and 0.12.x

License

MIT, from Maritime.

Metadata

Release files for langchain-maritime 0.1.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-maritime 0.1.0
File Size Uploaded Provenance Actions
langchain_maritime-0.1.0.tar.gz 14.9 kB Without provenance Details for langchain_maritime-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-maritime 0.1.0
File Interpreter ABI Platform Actions
langchain_maritime-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_maritime-0.1.0-py3-none-any.whl

Total release size: 25.8 kB

Release files / langchain_maritime-0.1.0.tar.gz

Download URL langchain_maritime-0.1.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
17a06eca15bc19378111aecf30eceddd9f87dc1ff927140c60115b4554e73d0a
BLAKE2b-256 checksum
How to use checksums
ddfe530307d2febfae24e919a52f57cf0d3d90ca46ae19e48b8b0e9d0fd68bca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Release files / langchain_maritime-0.1.0-py3-none-any.whl

Download URL langchain_maritime-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66a2fcf413b089698d905d783298cfa510015901794975de43f3b365ce2b0824
BLAKE2b-256 checksum
How to use checksums
165e4f5740773ad9f5567c1b2469ec1f65209c6b03e6d469ed1ff98a892e5bce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Security for langchain-maritime 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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