Skip to main content

Requirements

  • Docker running locally
  • curl or any HTTP client

1. Start Petri

git clone https://github.com/jhansi-io/petri.git
cd petri
poetry install
make run
Petri is now running at http://localhost:8000.

2. Create a sandbox

curl -X POST http://localhost:8000/v1/sandboxes \
  -H "Content-Type: application/json" \
  -d '{"language": "python"}'
{
  "id": "sb_abc123",
  "language": "python",
  "status": "created"
}

3. Upload a file

Create a simple Python file:
echo "print('hello from jhansi.io')" > main.py
Upload it to your sandbox:
curl -X POST http://localhost:8000/v1/sandboxes/sb_abc123/files \
  -F "file=@main.py"

4. Execute it

curl -X POST http://localhost:8000/v1/sandboxes/sb_abc123/exec \
  -H "Content-Type: application/json" \
  -d '{"filename": "main.py"}'
{
  "output": "hello from jhansi.io\n"
}

Next steps

API Reference

Explore the full API.

Self Hosting

Deploy Petri in production.