GitHub - submilli/submilli-python: Python SDK and LangChain / Deep Agents middleware for Submilli: code mode for agents, with TypeScript programs that run on submilli-server under a Blueprint's policy. · GitHub
Skip to content

About

Python SDK and LangChain / Deep Agents middleware for Submilli: code mode for agents, with TypeScript programs that run on submilli-server under a Blueprint's policy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

langchain-submilli

Submilli is a dedicated secure runtime for code-mode agents, with built-in isolation, governance, and permissions.

langchain-submilli is the Python integration for LangChain and Deep Agents. It lets your agent execute TypeScript code in Submilli's runtime.

Docs · Connect Deep Agents · Package reference · Submilli runtime · Discord · Website

PyPI: langchain-submilli PyPI: submilli CI License: Apache 2.0

Let your coding agents do the work

Copy this prompt into your coding agent to connect your LangChain or Deep Agents project to Submilli:

Show prompt
Connect this project’s LangChain or Deep Agents agent to Submilli. Follow
https://submilli.ai/docs/tutorials/connect-deepagents/.
Keep the existing model. Show me how existing application tools will be
available to the agent, and which calls will go through Submilli.
Show me the Blueprint and code changes. Test with mocked model responses.

Why

Code mode lets agents write code instead of calling tools one at a time. The agent submits code, and Submilli compiles and runs it in WebAssembly for isolation. Programs have no direct access to the network or host filesystem. Programs use Packages to access external systems, and Blueprints define which operations are allowed. See the execution challenges for why isolation alone is not enough.

Example

Suppose your support agent can send replacements with shipping costs up to $25. A prompt can ask the model to respect that limit, but the model can still generate code that exceeds it. Set the limit in a Blueprint, and Submilli enforces it. In the video, a replacement with $18 shipping is allowed and a replacement with $42 shipping is blocked. That replacement succeeds after the developer raises the limit to $50.

submilli-allow-deny-allow-silent.mp4

Install

Python 3.11 or later is required.

pip install "langchain-submilli[deepagents]"

For a different LangChain v1 agent, install langchain-submilli without the deepagents extra. To use submilli-server directly from Python, install the submilli SDK instead.

Follow Connect Deep Agents for the complete setup, including the server, Blueprint, model provider, agent, and session cleanup.

Use your existing LangChain tools

Your agent can call your existing LangChain tools from the code it runs through Submilli. Pass those tools to SubmilliMiddleware with ptc to make them available to the program.

The integration guide explains how these calls work. See the LangChain configuration for the ptc option.

Next steps

To control what the agent may do, create a Blueprint and register it on your server. The permissions reference covers rules for the operations your agent needs.

To pass application context or credentials to Submilli, see the middleware settings. The session reference explains reuse across turns and cleanup.

What the Submilli runtime provides

  • Blueprints define rules for operation arguments, bind values per session, and deny everything else by default.
  • Packages wrap APIs in operations the Blueprint can govern. Credentials can be attached by the host without being returned to the program, and curated integrations cover common services.
  • Resource limits bound memory, execution time, stack depth, model tokens, and more.
  • The audit trail records refusals, runs, sessions, and administrative changes.
  • MCP servers can be exposed as Packages, so Blueprint rules apply to their tools.
  • Server controls include HTTPS, API tokens with administrative and user roles, and an encrypted secret store.

For production, deploy with Docker Compose, Kubernetes, or Linux and systemd.

Status

Submilli is young and moving quickly. Breaking changes are recorded in the langchain-submilli changelog and submilli changelog. To talk with us, email hello@submilli.ai or join Discord.

Development

This repository is a uv workspace. In the workspace, langchain-submilli uses packages/submilli directly. When published, it depends on submilli from PyPI.

uv sync --all-packages --all-groups
uv run ruff check .
uv run ruff format .

Run type checks and tests inside each package:

cd packages/submilli            # or packages/langchain-submilli
uv run mypy
uv run pyright
uv run pyright --verifytypes submilli --ignoreexternal             # packages/submilli
uv run pyright --verifytypes langchain_submilli --ignoreexternal   # packages/langchain-submilli
uv run pytest

Integration tests start submilli-server from $SUBMILLI_BIN or PATH. A release build can live in the ignored .submilli-bin/ directory:

SUBMILLI_BIN=$PWD/../../.submilli-bin uv run pytest tests/integration         # submilli
SUBMILLI_BIN=$PWD/../../.submilli-bin uv run pytest tests/integration_tests   # langchain-submilli

Some langchain-submilli integration tests also need the research Blueprint. packages/langchain-submilli/scripts/test-server.sh starts a suitable server.

From the repository root, after changing packages/submilli/src/submilli/_async_client.py, regenerate the sync client:

uv run python packages/submilli/scripts/generate_sync.py

CI and releases

CI runs formatting, linting, type checks, unit tests, integration tests, and standalone wheel installation checks.

Release a package by pushing a tag that matches its pyproject.toml version: submilli-v0.1.0 or langchain-submilli-v0.1.0. The release workflow publishes that package to PyPI through trusted publishing. Release submilli before a langchain-submilli version that depends on it.

License

Apache License 2.0.

About

Python SDK and LangChain / Deep Agents middleware for Submilli: code mode for agents, with TypeScript programs that run on submilli-server under a Blueprint's policy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages