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

When to use

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

Basic usage

from synth_ai.core.tunnels import TunneledLocalAPI

tunnel = await TunneledLocalAPI.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 task app
  4. Responses stream back through the relay

Auth

Use task_app_worker_token with optimization jobs:
job = PromptLearningJob.from_dict(
    config,
    task_app_url=tunnel.url,
    task_app_worker_token=tunnel.worker_token,
)

Cleanup

tunnel.close()