Tools

AI Gallery

Tools

AI Gallery

Tools

AI Gallery

Jneid Jneid

Published on Jan 24, 2025

Safe AI Code Execution

Jneid Jneid

Published on Jan 24, 2025


Running AI-generated code locally poses security risks. Here's how you can run LLM-generated code in a secure Docker-based execution environment.

Agent takes in a task description, such as:

"Analyze American Airlines (AAL) stock, include last 2 years use scikit learn"


then, generates a code to perform this task, executes the code in a docker container and analyses the results

Core Features

- Isolated Docker containers for each execution

- Automatic dependency management within containers

- Resource usage controls and timeouts

- Container auto-removal after completion

Implementation

Uses async Python with Docker to create disposable environments. Integrates with OpenAI's GPT models while maintaining security boundaries through:

- Container isolation

- Resource limits

- Automatic cleanup

- Dependency handling

Quick Start

1. Install requirements: Python 3.8+, Docker

2. Configure Docker socket

3. Set OpenAI API key

4. Initialize executor and run code

See GitHub documentation for setup and usage examples.

---

GitHub: code-guardian


if you have any questions, please do not hesitate to ask faizan|jneid@slashml.com.

If you are self-hosting, try out our dashboard

If you are self-hosting, try out our dashboard

Deploy any model In Your Private Cloud or SlashML Cloud

READ OTHER POSTS

©2024 – Made with ❤️ & ☕️ in Montreal

©2024 – Made with ❤️ & ☕️ in Montreal

©2024 – Made with ❤️ & ☕️ in Montreal