Skip to main content

langchain-novita

Novita sandbox backend integration for LangChain Deep Agents.

Novita provides code interpreter sandboxes for running commands in isolated environments. See the Novita docs for signup, authentication, and platform details.

Installation

pip install -U langchain-novita
uv add langchain-novita

Set your Novita credentials:

export NOVITA_API_KEY="your-api-key"

Create a sandbox backend

In Python, create the sandbox using the Novita SDK, then wrap it with the Deep Agents backend:

from novita_sandbox.code_interpreter import Sandbox

from langchain_novita import NovitaSandbox

sandbox = Sandbox.create()
backend = NovitaSandbox(sandbox=sandbox)

result = backend.execute("echo hello")
print(result.output)

Use with Deep Agents

Novita's LLM API is compatible with OpenAI's Chat Completions API. To use Novita models with Deep Agents, install langchain-openai and configure ChatOpenAI with Novita's base URL.

pip install -U langchain-openai

Set the model ID:

export NOVITA_MODEL_ID="deepseek/deepseek-v4-pro"
import os

from langchain_openai import ChatOpenAI
from novita_sandbox.code_interpreter import Sandbox

from deepagents import create_deep_agent
from langchain_novita import NovitaSandbox

sandbox = Sandbox.create()
backend = NovitaSandbox(sandbox=sandbox)

model = ChatOpenAI(
    model=os.environ["NOVITA_MODEL_ID"],
    api_key=os.environ["NOVITA_API_KEY"],
    base_url="https://api.novita.ai/openai",
)

agent = create_deep_agent(
    model=model,
    system_prompt="You are a coding assistant with sandbox access.",
    backend=backend,
)

result = agent.invoke(
    {
        "messages": [
            {"role": "user", "content": "Create a hello world Python script and run it"}
        ]
    }
)

Cleanup

You are responsible for managing the sandbox lifecycle via the Novita SDK. When you are done, kill the sandbox:

sandbox.kill()

Testing

Install test dependencies:

poetry install --with test

Run unit tests:

poetry run pytest tests/unit_tests

Run the standard sandbox integration tests:

export NOVITA_API_KEY="your-api-key"
poetry run pytest tests/integration_tests/test_sandbox.py

Metadata

Release files for langchain-novita 0.1.1

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-novita 0.1.1
File Size Uploaded
langchain_novita-0.1.1.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-novita 0.1.1
File Interpreter ABI Platform
langchain_novita-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / langchain_novita-0.1.1.tar.gz

Download URL langchain_novita-0.1.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1505ae302f33f9249479fb06ffeb501e961e0ba3a645508af752aa7da6ea31eb
BLAKE2b-256 checksum
How to use checksums
cca3b072440b682536602d1fc3d98a73cf75e3f6c85c8cbe1caf091904e762cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.2 Darwin/25.3.0

Release files / langchain_novita-0.1.1-py3-none-any.whl

Download URL langchain_novita-0.1.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a77dc7d49c19f827e9e90bca4be1b80aa43c60785f38fbe43e1f3f690472f64c
BLAKE2b-256 checksum
How to use checksums
84b16bb5d23d89c78661ee43d42910a06cf021c5a8ba7c3ab7797604f960884a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.2 Darwin/25.3.0

Release history Release notifications | RSS feed

This release

0.1.1 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