How AI Agents Use Parallel for Testing
The Problem
Agents need to test code that uses databases, caches, and message queues. Current options:
- Mock everything (unreliable, doesn't catch real bugs)
- Use real services (slow, expensive, side effects)
- Skip testing (dangerous)
The Solution
Parallel gives agents a lightweight gym to practice against real protocols.
Agent Experience
Option 0: Remote sandbox — just an API key + a sidecar (no app changes)
The leanest agent path: add the Parlel bridge sidecar to your stack and
point your app at it. The bridge provisions a sandbox from a pk_ key and
exposes every dependency on a plain hostname — Postgres/Redis over a WebSocket
tunnel (the sandbox's HTTPS preview proxy can't carry raw TCP), Jira/Stripe/etc.
via a token-injecting reverse-proxy. Your application code is unchanged: it
connects to parlel-bridge:<port> exactly as it would to a real service in
production. No SSH tunnel, no daytona CLI, no Parlel code in your app.
# docker-compose.test.yml
include:
- path: parlel-bridge.yml # image: parlel/bridge
services:
app:
build: .
env_file: test.env # DATABASE_URL=postgres://parlel:parlel@parlel-bridge:5432/parlel
depends_on:
parlel-bridge: { condition: service_healthy }
PARLEL_API_KEY=pk_... docker compose -f docker-compose.test.yml up
Your app's unmodified drivers connect straight through:
import psycopg, redis # unmodified, real wire protocol
db = psycopg.connect("postgres://parlel:parlel@parlel-bridge:5432/parlel")
cache = redis.Redis(host="parlel-bridge", port=6379)
A sandbox with no services specified defaults to Postgres + Redis. See the Flask CRUD example for the full sidecar flow, and Agent Access for the API + bridge details.
Option 1: Drive setup over MCP
Every sandbox exposes an MCP endpoint. Agents seed data and inspect state with
the parlel_execute tool — no driver needed:
{
"name": "parlel_execute",
"arguments": {
"service": "postgres",
"command": "CREATE TABLE users (id serial, email text); SELECT * FROM users;"
}
}
Then exercise your application code against the same sandbox through the bridge sidecar (Option 0). See Agent Access for the full API.
What Agents Get
| Feature | Benefit |
|---|---|
| Real protocols | redis-cli, psql work |
| Zero side effects | Ephemeral state |
| Fast startup | <1 second |
| Small footprint | ~220KB total |
| Auto cleanup | No leftover data |
Example: testing a user service
Your test suite is whatever you already use — it just runs against the bridge hostnames. Nothing Parlel-specific in the code:
# conftest.py / fixtures point at the bridge; the app reads its normal env vars
import os, psycopg, redis
from user_service import UserService
def test_create_and_cache_user():
db = psycopg.connect(os.environ["DATABASE_URL"]) # parlel-bridge:5432
cache = redis.from_url(os.environ["REDIS_URL"]) # parlel-bridge:6379
svc = UserService(db, cache)
user = svc.create_user("alice@test.com", "Alice")
assert user.id
assert "Alice" in cache.get(f"user:{user.id}")
Run it inside the compose stack (docker compose -f docker-compose.test.yml run app pytest)
or against a sandbox you provisioned over the API.
Architecture
┌──────────────────────────────────────────────┐
│ Your app / tests │ (unchanged, plain env vars)
├──────────────────────────────────────────────┤
│ DATABASE_URL → parlel-bridge:5432 │
│ REDIS_URL → parlel-bridge:6379 │
├──────────────────────────────────────────────┤
│ parlel/bridge (Docker sidecar) │
│ TCP-over-WS │ HTTP reverse-proxy + token │
├──────────────────────────────────────────────┤
│ Parlel sandbox (hosted, ephemeral) │
│ Postgres │ Redis │ Kafka │ Stripe │ Jira … │
└──────────────────────────────────────────────┘
Why This Works
- Real protocols - Not mocks. Real Redis RESP, Postgres/MySQL wire protocol,
Kafka binary protocol (real
kafkajsproduces and consumes), and AMQP 0-9-1 (realamqplibpublishes and consumes). - Ephemeral - State disappears when tests end.
- Fast - Starts in <1 second.
- Small - ~220KB vs ~880MB for real services.
- Composable - Use only what you need.
- Remote with just a key - In a sandbox, the
parlel/bridgesidecar lets unmodified drivers connect over an API key — no SSH, no CLI, no app changes.