inis.run
Integrations

Pydantic AI

Pydantic AI toolset for Python agents.

Pydantic AI is the recommended Python agent framework for new projects. The inis integration wraps the Python SDK as a ready-made toolset — persistent session, shell, files, and code execution.

Status: Available as pip install inis-pydantic-ai (requires inis on PyPI).

Install

pip install inis-pydantic-ai

Usage

import os
from inis import Client
from pydantic_ai import Agent
from inis_pydantic_ai import inis_toolset

# Create a persistent session first
client = Client(token=os.environ["INIS_API_KEY"])
session = client.sessions.create()

agent = Agent(
    "openai:gpt-4o",
    toolsets=[inis_toolset(session_id=session.session_id, api_key=os.environ["INIS_API_KEY"])],
    system_prompt="Run Python in the sandbox instead of guessing.",
)

result = agent.run_sync("Plot a histogram of [1, 2, 2, 3, 3, 3, 4] with matplotlib")
print(result.output)

What inis_toolset() provides

ToolDescription
execute_pythonRun Python in the sandbox
run_shellRun an arbitrary shell command
read_file / write_fileFile I/O under /workspace
expose_portHTTPS preview URL for a guest port

The toolset holds a persistent session for the agent run — multiple tool calls share state without re-booting the VM.

Configuration

inis_toolset(
    session_id="ses_...",         # session ID (required)
    api_key="inis_...",           # or $INIS_API_KEY
    base_url="https://api.inis.run",
)

vs LangChain

Pydantic AILangChain
Typed tools, minimal boilerplateLarger ecosystem, LangGraph for graphs
Best for new Python agent appsBest if you are already on LangChain

Both wrap the same Python SDK. Pick one — or use remote MCP and skip framework glue entirely.

On this page