AgentRun  by tjmlabs

Python library for safely running AI-generated code

created 1 year ago
329 stars

Top 84.2% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

AgentRun provides a secure and efficient way to execute AI-generated Python code, targeting developers integrating LLMs into their applications. It simplifies the process of allowing LLMs to write and run code, enhancing their capabilities for tasks like data analysis and complex calculations, while mitigating security risks.

How It Works

AgentRun leverages Docker for isolated execution environments and RestrictedPython for code safety. It automatically manages dependencies, resource limits, and timeouts within a sandboxed container. This approach ensures that potentially malicious or resource-intensive code generated by LLMs cannot harm the host system or consume excessive resources.

Quick Start & Requirements

  • REST API: Clone the repository, navigate to agentrun-api, copy .env.example to .env.dev, and run docker-compose up -d --build. Access via http://localhost:8000/v1/run/.
  • Python Library: Install with pip install agentrun. Requires a running Docker container.
  • Dependencies: Docker, Python.

Highlighted Details

  • Median execution time is under 200ms without dependencies, ~400ms with common dependencies like requests.
  • Offers a REST API for easy self-hosting and integration.
  • Supports dependency caching for faster subsequent runs.
  • Provides granular control over resource limits (CPU, memory, swap) and execution timeouts.

Maintenance & Community

The project is maintained by tjmlabs. Further community or roadmap information is not detailed in the README.

Licensing & Compatibility

The project appears to be licensed under the MIT License, allowing for commercial use and integration into closed-source projects.

Limitations & Caveats

Dependency installation time can be a bottleneck, especially for packages with many sub-dependencies or when caching is not utilized. The effectiveness of resource limits depends on Docker's configuration and the underlying host system.

Health Check
Last commit

8 months ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
0
Star History
30 stars in the last 90 days

Explore Similar Projects

Starred by Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), Tim J. Baek Tim J. Baek(Founder of Open WebUI), and
1 more.

harbor by av

0.3%
2k
CLI tool for local LLM stack orchestration
created 1 year ago
updated 3 weeks ago
Feedback? Help us improve.