Skip to main content
SynthTunnel is the default tunnel backend. It requires no external binary and keeps your container private behind an outbound WebSocket connection.

When to use

  • GEPA/MIPRO rollouts
  • Short-lived containers
  • Local development without port forwarding

Basic usage

from synth_ai.core.tunnels import SynthTunnel

tunnel = await SynthTunnel.create(
    local_port=8001,
    api_key="sk_live_...",
)
print(tunnel.url)
print(tunnel.worker_token)

How it works

Synth backend ──HTTP──▶ relay (st.usesynth.ai) ──WS──▶ local agent ──HTTP──▶ localhost:8001
  1. The SDK provisions a lease on the Synth relay
  2. A local agent connects outbound over WebSocket
  3. Requests are forwarded to your local container
  4. Responses stream back through the relay

Auth

Use container_worker_token with optimization jobs:
job = OfflineJob.from_dict(
    config,
    container_url=tunnel.url,
    container_worker_token=tunnel.worker_token,
)

Cleanup

tunnel.close()