Skip to main content

Python code execution sandbox based on IPython and Docker

Project description

ipybox

Website PyPI - Version GitHub Release GitHub Actions Workflow Status GitHub License PyPI - Python Version

ipybox is a lightweight, stateful and secure Python code execution sandbox built with IPython and Docker. Designed for AI agents that interact with their environment through code execution, like the freeact agent system, it is also well-suited for general-purpose code execution. ipybox is fully open-source and free to use, distributed under the Apache 2.0 license.

logo

Features

  • Secure Execution: Executes code in isolated Docker containers, preventing unauthorized access to the host system
  • Stateful Execution: Maintains variable and session state across commands using IPython kernels
  • Real-Time Output Streaming: Provides immediate feedback through direct output streaming
  • Enhanced Plotting Support: Enables downloading of plots created with Matplotlib and other visualization libraries
  • Flexible Dependency Management: Supports package installation and updates during runtime or at build time
  • Resource Management: Controls container lifecycle with built-in timeout and resource management features
  • Reproducible Environments: Ensures consistent execution environments across different systems

Documentation

The ipybox documentation is available here.

Quickstart

Install ipybox Python package:

pip install ipybox

Execute Python code inside ipybox:

import asyncio
from ipybox import ExecutionClient, ExecutionContainer

async def main():
    async with ExecutionContainer(tag="ghcr.io/gradion-ai/ipybox:minimal") as container:
        async with ExecutionClient(port=container.port) as client:
            result = await client.execute("print('Hello, world!')")
            print(f"Output: {result.text}")

if __name__ == "__main__":
    asyncio.run(main())

Find out more in the user guide.

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

jarvis_ipybox-0.4.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

jarvis_ipybox-0.4.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file jarvis_ipybox-0.4.0.tar.gz.

File metadata

  • Download URL: jarvis_ipybox-0.4.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for jarvis_ipybox-0.4.0.tar.gz
Algorithm Hash digest
SHA256 698c264bbb8f0702871817084460af84a671b5e45d18bb540824db841a4177c6
MD5 b153a0345fcdb0f5dd29063f38eeccf1
BLAKE2b-256 8572e3fe99964e962f0128388bbd4be94073b71cf0ebed281b1ab7654a9ad8e1

See more details on using hashes here.

File details

Details for the file jarvis_ipybox-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: jarvis_ipybox-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for jarvis_ipybox-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6006f6285961a0466d6793b29bf5d626f89336f6d5b72d917a86f90565318698
MD5 d0e31dfa5cd8787559f4109c5976c4fb
BLAKE2b-256 a89e5ccc112032adf39482d91445d48360c2c3dbbb784858560cea76afc30e84

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