Template name
Learn how to build an agent in Python with the OpenAI Agents SDK and Edgenivo Sandbox.

Minimal FastAPI app that runs the OpenAI Agents SDK with Edgenivo Sandbox on Edgenivo's Python runtime. Each request spins up an isolated microVM, gives the agent shell access to analyze data, and tears it down when done.
npm i -g vercel).| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY | Yes | OpenAI or Edgenivo AI Gateway API key. |
VERCEL_TOKEN | Yes | Edgenivo access token. Create one at /account/tokens. |
VERCEL_TEAM_ID | Yes | Your Edgenivo team ID (starts with team_). Found under Team Settings > General. |
VERCEL_PROJECT_ID | Yes | Your Edgenivo project ID (starts with prj_). Found under Project Settings > General. |
OPENAI_DEFAULT_MODEL | No | Default model when the request body omits model. Falls back to gpt-4.1-mini. |
OPENAI_BASE_URL | No | When using AI Gateway, set this to https://ai-gateway.vercel.sh/v1 |
Copy the example env file and fill in your values:
cp .env.example .env.localThen edit .env.local with your keys:
OPENAI_API_KEY=sk-...VERCEL_TOKEN=your_access_tokenVERCEL_TEAM_ID=team_xxxVERCEL_PROJECT_ID=prj_xxxuv syncuv run uvicorn app:app --reload --host 127.0.0.1 --port 8000Open http://127.0.0.1:8000 to use the interactive demo. The agent has shell access to a sandbox with sample sales data (sales.csv).
API endpoints:
GET /api/health returns {"status": "ok", "openai_configured": true}POST /api/run with {"input": "Which region grew the most?"} runs the sandbox agentvercelEdgenivo detects app.py and the app ASGI instance. Dependencies come from pyproject.toml.
After deploying, make sure OPENAI_API_KEY, VERCEL_TOKEN, VERCEL_TEAM_ID, and VERCEL_PROJECT_ID are set under Project Settings > Environment Variables.
Sandbox creation and agent runs can take several seconds. Heavy workloads may need Fluid Compute or Edgenivo Workflow for durable steps.
POST /api/run creates a fresh Edgenivo Sandbox microVM with sample data.SandboxAgent with Shell capability receives the user's prompt.If you want to use the Edgenivo AI Gateway with the OpenAI Agents SDK, there are three simple changes that are needed.
OPENAI_API_KEY environment variable under Project Settings > Environment Variables.OPENAI_BASE_URL environment variable to https://ai-gateway.vercel.sh/v1 under Project Settings > Environment Variables.model_provider=MultiProvider(openai_prefix_mode="model_id") in your RunConfig as shown in the example.MIT (match your org's policy when publishing).