Skip to main content

smolagents-withruntime

Run the Python a smolagents CodeAgent writes in a Runtime Cloud sandbox, a Firecracker microVM with its own Linux kernel, instead of in your own process. It is a smolagents remote executor, like the E2B, Modal and Blaxel ones: variables, imports and files persist between the agent's steps.

pip install smolagents-withruntime

Set RUNTIME_API_KEY to a key from withruntime.com/account/keys, or run npx withruntime login once on the machine.

from smolagents import CodeAgent, InferenceClientModel
from smolagents_withruntime import RuntimeExecutor

agent = CodeAgent(
    tools=[],
    model=InferenceClientModel(),
    executor=RuntimeExecutor(["pandas"]),  # packages to install first
)
try:
    agent.run("Load https://example.com/data.csv and give me the mean of the second column.")
finally:
    agent.cleanup()  # stops the sandbox

RuntimeExecutor(additional_imports, logger=None, allow_pickle=False, *, sandbox=None, timeout_seconds=60, **create):

  • **create takes sandbox fields for a new sandbox, such as image, vcpu, memory_mib, network or labels. The executor owns that sandbox and cleanup() stops it.
  • sandbox= runs in a withruntime.Sandbox you already have; cleanup() leaves it running.
  • timeout_seconds bounds each code step.
  • A cell's main result comes back as its value; a figure a cell shows, such as a matplotlib plot, comes back as a PIL image.

The package registers runtime in the smolagents.executors entry point group, so once smolagents loads executors from it (huggingface/smolagents#2722), CodeAgent(..., executor_type="runtime") works too.

Tests

pip install -e . pytest
python -m pytest tests                     # no account needed
RUNTIME_API_KEY=... python scripts/e2e.py  # a real sandbox, no model calls

Metadata

Release files for smolagents-withruntime 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 smolagents-withruntime 0.1.0
File Size Uploaded Provenance
smolagents_withruntime-0.1.0.tar.gz 10.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for smolagents-withruntime 0.1.0
File Interpreter ABI Platform
smolagents_withruntime-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / smolagents_withruntime-0.1.0.tar.gz

Download URL smolagents_withruntime-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fc212c3156933392cec7cef0c656f525c481148b41e9e507363c12f504bfcd7d
BLAKE2b-256 checksum
How to use checksums
cd94be649c620bee1aac48f1813116c56a78b7d0cf65359b566c3c23938cfb3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

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

Download URL smolagents_withruntime-0.1.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20672cfb16e73cf376e18218474acbe3bcb83fcefb12e230e77bf166328b7c92
BLAKE2b-256 checksum
How to use checksums
65d75bc255e3eaa0f34e10366336ff89bb47c1d713227fb33d61d36bbf9e5029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for smolagents-withruntime 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smolagents_withruntime-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

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 Full 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