Skip to content

gradion-ai/ipybox

Repository files navigation

ipybox

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

ipybox is a lightweight and secure Python code execution sandbox based on IPython and Docker. You can run it locally on your computer or remotely in an environment of your choice - no API key required.

Designed for AI agents that interact with their environment through code execution, like freeact agents, it is also well-suited for many other secure code execution use cases. ipybox is fully open-source and distributed under the Apache 2.0 license.

logo

Features

  • Secure code execution inside Docker containers
  • Stateful code execution with IPython kernels
  • Stream code execution output as it is generated
  • Install Python packages at build time or runtime
  • Return plots generated with visualization libraries
  • Invocation of MCP servers via generated client code
  • Flexible deployment options, local or remote
  • asyncio API for managing the execution environment

Documentation

Quickstart

Install ipybox Python package:

pip install ipybox

Execute Python code in an ipybox container:

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.executor_port) as client:
            result = await client.execute("print('Hello, world!')")
            print(f"Output: {result.text}")

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

About

A lightweight and secure Python code execution sandbox based on IPython and Docker

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •