Skip to main content

EZ Smolagents makes smolagents easy.

Project description

EZSmolagents

EZSmolagents makes smolagents easy - a simplified API for running AI agents with LiteLLMModel using Docker isolation.

Quick Start

from easyrun import run_simple

result = run_simple("Write a Python script that fetches weather data", model="openai/gpt-4o-mini")

Installation

pip install -e .

Requires Docker and a LiteLLM-compatible API key (e.g., OpenRouter).

Features

  • Docker isolation: Safe execution with configurable security levels
  • Multiple execution modes: Docker (isolated) or local (development)
  • Streaming support: Real-time output
  • Any LiteLLM model: OpenAI, Anthropic, Google, etc.
  • Simple API: Just import and run

Usage

Docker Execution (default)

from easyrun import run_simple

result = run_simple(
    prompt="Write a Python script that fetches weather data",
    model="openai/gpt-4o-mini",
    api_key="your-api-key",
    security_level="standard"  # or "strict" / "relaxed"
)

Streaming Execution

from easyrun import run_simple_stream

for line in run_simple_stream("Write a report"):
    print(line, end="")

Local Execution (no Docker)

from easyrun import run_local

result = run_local("Debug this code", model="openai/gpt-4o-mini")

Security Levels

Level Capabilities Read-only FS Network Memory CPU
strict All dropped Yes Disabled 512MB 50%
standard All dropped No Enabled 1GB 100%
relaxed Minimal No Enabled None None

Custom Executor Scripts

You can also pass a custom executor script:

result = run_simple(
    "Analyze the data",
    model="openai/gpt-4o",
    executor_path="/path/to/my_task.py"
)

Your script should define a main(prompt, model) or run(prompt, model) function.

Setup

The Docker runner uses a custom image ezsmolagents-runner:latest with smolagents[litellm] pre-installed. Build it with:

docker build -t ezsmolagents-runner -f - . <<'EOF'
FROM python:3.13-slim
RUN pip install --no-cache-dir smolagents[litellm]>=1.24.0 docker>=7.1.0
EOF

Or use the pre-built image (if available).

License

GNU Affero General Public License v3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezsmolagents-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezsmolagents-0.1.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file ezsmolagents-0.1.0.tar.gz.

File metadata

  • Download URL: ezsmolagents-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ezsmolagents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d77f1221f3de5e95b547815d69425e8b909151190886bd0b5e4ba4c5110b5fd9
MD5 5019a86ce41d25e4301677c2addf7841
BLAKE2b-256 a865bb46ddc4a0a1ea70322edf281bf7c2a6754ef655c7718a4136dcee5c295d

See more details on using hashes here.

File details

Details for the file ezsmolagents-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ezsmolagents-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ezsmolagents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c1a4694bb0ac76d24036619c0571916309b2c05924577d4c8b23fedaf2f4cde
MD5 2b4d27fc025aeb969179a37bdc59797c
BLAKE2b-256 8165ad6bb69dbde5fa11621a7a136360c9611ea8787ebc95a2b03ad12d6ef021

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page