Skip to main content

toolplane

PyPI version Python versions CI Docs License: MIT

Define your agent's tool surface once — MCP servers, CLI binaries, Python functions — and get the same curated, sandboxed Python namespace under every agent client you use: Claude Code, Codex, opencode, or your own.

Full documentation: https://oneryalcin.github.io/toolplane/

Why

Agents are strongest when they use code as the control plane: looping, filtering, retrying, and combining tools in one pass instead of bouncing through one tool call at a time. Toolplane is the runtime for that:

discover capabilities -> inspect schemas -> execute Python against a curated namespace

Instead of registering N MCP servers in every agent client (and paying for N × dozens of tool schemas in every context window, in every client, with every client's different quirks), you register one server that exposes three meta-tools. Your agent searches for what it needs, reads the exact schemas, and writes a snippet:

# one execute_code call replaces a dozen round-trips
rows = []
for repo in ["toolplane", "cli-to-py"]:
    prs = await github_list_pull_requests(repo=repo, state="merged", limit=25)
    for pr in prs:
        rows.append({"repo": repo, "title": pr["title"], "days_open": pr["days_open"]})
handle = await save_result(rows, label="pr-audit")
return {"count": len(rows), "handle": handle}

What makes toolplane different from other code-mode runtimes:

  • CLI binaries are first-class, policy-gated capabilities. git, gh, jq become async Python functions behind an allowlist you control — not a raw shell. No other code-mode runtime ships this lane.
  • Policy escalates to a human instead of dead-ending. If a snippet needs a binary outside the allowlist, your agent client shows you a form: allow it for this session, or refuse. Declines stick; nothing is ever written back to config. (MCP elicitation on handshake-era clients, Multi Round-Trip Requests on 2026-07-28 ones such as current Claude Code; degrades to a plain refusal on clients that can't prompt.)
  • A measured envelope, not a slogan. We benchmarked code mode against raw MCP tool-calling in a real client and published where it loses. Two eras, labeled: 0.4.0 measured plain MCP ~20% cheaper at 30 tool interactions and code mode 15% cheaper at 100 (crossover unmeasured). 0.5.0 ships the call-shape facade, which moves the crossover below 30: code mode runs flat per task at every task size ($0.18 in July), sits at parity with plain MCP around 20, and wins 45% cheaper at 100 — while single lookups still favor direct calls (+28%) and a sequentially-adaptive "chain" task cost code mode +38% in July. Re-run on the shipped 0.5.0 (Oct 2026, newer client): every run that reached the backend was correct, and with the discovery turn gone, passing code-mode runs undercut plain MCP at every loop size and beat it on wall time from 10 records up (~5x at 100; still ~45% cheaper there). But on Sonnet 5, 4 of 28 code-mode runs gave up without searching for the tools, which, priced in, keeps small tasks cheaper on plain MCP; Haiku 5.5 and Sonnet 5.5 never did (0/60, 0/40; #150). Chain's cost gap narrowed to +7%, though it stays slower. The surprise in both eras: round-trips aren't the mechanism (clients batch tool calls in parallel); output-token scaling and context growth are. Harness and raw results in bench/; numbers, variance, and limitations in The Code-Mode Envelope, Measured.
  • Safe by default, with zero infrastructure. The default backend (Monty) is a sandboxed interpreter with no filesystem or network access — a pure pip install, no Docker, no Deno, no daemon.
  • Credentials handled like they matter. OAuth servers: log in once in a browser, tokens persist Fernet-encrypted with the key in your OS keyring — every later session connects silently. API keys: reference them as keyring://<name> so toolplane.toml stays committable with zero secret material. Toolplane contains no token-handling code of its own — the flows, refresh, and encryption are FastMCP's; toolplane only configures where they happen.
  • Engineered for how agents actually behave. Every dead end emits a signpost (no-match searches say how to browse; policy errors name what is allowed), errors are catchable by builtin type on every backend, and the live namespace manifest (toolplane://namespace) never lies about the server's configuration. This surface is certified by cold-start agent sessions, not just unit tests — the design lessons are published in Agents Don't Find Resources and the firsthand MCP Client Capability Matrix.

Toolplane is developed and CI-tested on macOS and Linux (Python 3.11–3.13). Windows is currently untested — reports welcome. Found a bug or a rough edge? Open an issue — cold-start friction reports are especially valuable.

Quickstart

Set up a config (safe defaults: sandboxed backend, CLI disabled):

uvx toolplane init
uvx toolplane cli allow git
uvx toolplane mcp add context7 --url https://mcp.context7.com/mcp
uvx toolplane doctor

Prove it runs — put this in first.py:

v = await git("version")
return {"ok": v["ok"], "git": v["stdout"].strip()}
uvx toolplane run first.py

Then register it with your agent client (use the absolute path to your toolplane.toml):

# Claude Code
claude mcp add toolplane -- uvx toolplane serve mcp --config /path/to/toolplane.toml

# Codex
codex mcp add toolplane -- uvx toolplane serve mcp --config /path/to/toolplane.toml
// opencode (~/.config/opencode/opencode.json)
{
  "mcp": {
    "toolplane": {
      "type": "local",
      "command": ["uvx", "toolplane", "serve", "mcp", "--config", "/path/to/toolplane.toml"]
    }
  }
}

Tip: name the registration after what it serves. The name you register under becomes the tools' prefix (mcp__toolplane__execute_code), and clients that defer tool loading show the model only those names before it decides what to search for. If your config fronts one domain, a name like orders tells the model where that data lives: in a benchmark, the same facade registered as orders instead of toolplane let the agent skip a discovery call (0/60 vs 7/60 runs, Haiku 5.5). The effect was small, so if the config fronts several unrelated domains, toolplane is a fine default.

Every client now sees the same three tools — search_capabilities, get_capability_schemas, execute_code — plus the live manifest resource toolplane://namespace and a bundled usage skill. Ask your agent to read the manifest and go.

Already using MCP servers?

Bring your existing Claude Code or Codex servers over in one command:

uvx toolplane mcp import --from claude --dry-run   # see what would happen
uvx toolplane mcp import --from claude
uvx toolplane mcp import --from codex

Import never copies secrets into the TOML: secret-looking values are moved into your OS keyring (written as keyring://... references), and mcp-remote-style OAuth wrapper entries are rewritten to direct url entries that use toolplane's encrypted token storage instead. The report tells you exactly what it did and what to run next.

Private servers and credentials

For an OAuth-protected MCP server (Linear, Notion, ...), log in once — tokens persist encrypted (key in your OS keyring), and every later agent session connects silently:

uvx toolplane mcp add linear --url https://mcp.linear.app/mcp --auth oauth
uvx toolplane mcp login linear   # one browser consent, ever

For API-key servers, store the key in the OS keyring and reference it — your toolplane.toml stays committable with no secret material in it:

uvx toolplane secret set docs-api-token   # value via prompt or stdin
[mcp.servers.internal_docs]
url = "https://docs.example.com/mcp"

[mcp.servers.internal_docs.headers]
Authorization = "keyring://docs-api-token"   # or "env://DOCS_TOKEN" for CI

See configuration for the full credential story.

What your agent gets

  • Three meta-tools instead of a tool catalog. Search is exact-word (an empty query lists everything); schemas come back only for the capabilities the snippet will actually use.
  • A flat, async Python namespace. MCP tools as flat functions — await context7_get_docs(...) — or canonically as await call_tool("mcp:context7/get_docs", {...}); allowlisted CLI binaries as await git("log", oneline=True, max_count=3) returning {'stdout', 'stderr', 'exit_code', 'ok'}. (Scoped sugar like context7.get_docs(...) exists on the non-default backends; the monty default is flat-only — the manifest always shows the shapes that work.)
  • State between runs, off the context window. Variables persist across runs like notebook cells (a timed-out run rolls back cleanly; await reset_session() starts fresh). For values that must survive a reset or be read as MCP resources: save_result/load_result for JSON-shaped data, save_artifact/load_artifact for bytes (CSVs, images, parquet) — on Claude Code, a saved artifact materializes as a real local file.
  • Errors written for agents, not log files. The real exception type and message on every backend, catchable by builtin type (except ValueError for store failures, except PermissionError for CLI policy, except LookupError for unknown capabilities) — identically on all three backends.

Use it as a library

The same runtime embeds directly in Python — register your own functions and execute agent-written snippets against them, sandboxed, with no server in between:

from toolplane import Toolplane

runtime = Toolplane()

@runtime.tool(tags={"math"})
def add(x: int, y: int) -> int:
    """Add two numbers."""
    return x + y

result = await runtime.execute("""
value = await call_tool("add", {"x": 2, "y": 3})
return value
""")

And if you already have an agent framework, as_tool() packages the whole runtime as one run_code tool — a plain async function with a generated description (compact enough for OpenAI's tool-description cap) that pydantic-ai, the OpenAI Agents SDK, and LangChain/LangGraph all accept directly. It is sandboxed monty by default: model-authored code never inherits the local_unsafe dev backend implicitly — that requires an explicit backend="local_unsafe" opt-in:

from pydantic_ai import Agent

agent = Agent("anthropic:claude-sonnet-5", tools=[runtime.as_tool()])

MCP servers, explicit CLI wrappers, and scoped Python namespaces register the same way — see the library guide and examples for the full surface, including config-driven setup (Toolplane.from_config), the result/artifact stores, and runnable as_tool examples for all three frameworks.

Backends

Backend Use Status
monty Default. Sandboxed by construction (no filesystem/network), pure pip install. Flat Toolplane callable namespace; no third-party imports. Active
pyodide-deno Opt-in for package-capable snippets (pandas/NumPy-style) via Pyodide in Deno. Supported, feature-frozen
local_unsafe In-process execution for development only. Dev only

A container backend (real CPython, arbitrary packages) lands when a concrete use case needs it. See Code Mode Backends for the design record.

Design goals

  • Normalize heterogeneous tools into a Python-first API surface; JSON is the wire format, not the programming model.
  • Keep the exposed runtime curated rather than ambiently powerful; the host decides which capabilities exist and what boundaries apply.
  • Durable policy lives in config; session policy (escalation grants) dies with the process.
  • Canonical capability ids are qualified (mcp:server/tool); friendly aliases exist only when unambiguous.
  • Every slice earns its place through behavior, tests, or live certification.

Development

make test
make examples
make ci
make publish-check

Docs: make docs / make docs-serve. Publishing: PYPI_TOKEN=... make publish — see the release checklist.

See ROADMAP.md for sequencing and Architecture for code organization.

Metadata

Release files for toolplane 0.5.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 toolplane 0.5.1
File Size Uploaded Provenance Actions
toolplane-0.5.1.tar.gz 223.5 kB Without provenance Details for toolplane-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toolplane 0.5.1
File Interpreter ABI Platform Actions
toolplane-0.5.1-py3-none-any.whl Python 3 none any Details for toolplane-0.5.1-py3-none-any.whl

Total release size: 351.3 kB

Release files / toolplane-0.5.1.tar.gz

Download URL toolplane-0.5.1.tar.gz
Size 223.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e5cfcdab1f855469a7a765945041e3e17bc1b24bf4cb86675c8cb522049fe104
BLAKE2b-256 checksum
How to use checksums
1e9ec32e007551eb1a409b473305e6570903dd9aefe99e2ab6061f8a1d6753ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / toolplane-0.5.1-py3-none-any.whl

Download URL toolplane-0.5.1-py3-none-any.whl
Size 127.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4dc18b4420e54c525e36ebf314b654b275609385c514d315e2a13baa6e4ef385
BLAKE2b-256 checksum
How to use checksums
bbcf3e2fd0d20fd8823daa1a44342001a34b59cfb33925af68e7827cfc5bb514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for toolplane 0.5.1

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.

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