Skip to main content
# Run GEPA prompt optimization against any task app
# (after starting your task app and tunnel)
synth train gepa_config.toml --poll
Task apps can be written in any language as long as they implement the Synth task app contract (/health and /rollout).

Results summary (Banking77, GEPA)

LanguageJob IDAccuracySource
Rustpl_4f69a1b099a14e4b100%main.rs
TypeScriptpl_787c47998cfe474585.7%index.ts
Pythonpl_7e0227cc41454ec566.7%app.py
Gopl_1dd94dfdc8c6479d60.0%main.go
All jobs optimize prompts for the same Banking77 task app; only the implementation language changes.

Prerequisites

  • Synth CLI installed (synth on your PATH)
  • Task app contract implemented in one of:
    • Rust
    • TypeScript (Node.js / Bun / Deno)
    • Python
    • Go
  • ENVIRONMENT_API_KEY set in your shell
  • A Cloudflare tunnel or other public URL exposed for http://localhost:8001

Rust task app

cd cookbooks/code/polyglot/rust

# Build release binary
cargo build --release

# Start task app on localhost:8001
ENVIRONMENT_API_KEY=secret ./target/release/synth-task-app
Expose it via Cloudflare:
cloudflared tunnel --url http://localhost:8001
Run GEPA optimization (Banking77):
synth train gepa_config.toml --poll
Source:
main.rs · gepa_config.toml · walkthrough.md

Sample result (Rust)

Job pl_4f69a1b099a14e4b100% accuracy on Banking77.
{
  "job_id": "pl_4f69a1b099a14e4b",
  "language": "rust",
  "algorithm": "gepa",
  "best_score": 1.0,
  "total_time_seconds": 42.1
}

TypeScript task app

cd cookbooks/code/polyglot/typescript

# Install dependencies and start the server on localhost:8001
npm install
ENVIRONMENT_API_KEY=secret npm run dev
Expose it via Cloudflare:
cloudflared tunnel --url http://localhost:8001
Run GEPA optimization:
synth train gepa_config.toml --poll
Source:
index.ts · walkthrough.md

Sample result (TypeScript)

Job pl_787c47998cfe474585.7% accuracy on Banking77.
{
  "job_id": "pl_787c47998cfe4745",
  "language": "typescript",
  "algorithm": "gepa",
  "best_score": 0.8571
}

Go task app

cd cookbooks/code/polyglot/go

# Build and run binary on localhost:8001
go build -o synth-task-app
ENVIRONMENT_API_KEY=secret ./synth-task-app
Expose via Cloudflare:
cloudflared tunnel --url http://localhost:8001
Run GEPA optimization:
synth train gepa_config.toml --poll
Source:
main.go · gepa_config.toml · walkthrough.md

Sample result (Go)

Job pl_1dd94dfdc8c6479d60.0% accuracy on Banking77.
{
  "job_id": "pl_1dd94dfdc8c6479d",
  "language": "go",
  "algorithm": "gepa",
  "best_score": 0.60
}

Python task app

cd cookbooks/code/polyglot/python

# Install dependencies and start FastAPI/Flask app on localhost:8001
pip install -r requirements.txt
ENVIRONMENT_API_KEY=secret python app.py
Expose via Cloudflare:
cloudflared tunnel --url http://localhost:8001
Run GEPA optimization:
synth train gepa_config.toml --poll
Source:
app.py · walkthrough.md

Sample result (Python)

Job pl_7e0227cc41454ec566.7% accuracy on Banking77.
{
  "job_id": "pl_7e0227cc41454ec5",
  "language": "python",
  "algorithm": "gepa",
  "best_score": 0.6667
}

The task app contract

All of these task apps implement the same HTTP contract:
  • GET /health — basic health check used by Synth to discover and monitor the app
  • POST /rollout — evaluate a batch of prompt candidates and return rewards/metrics
OpenAPI spec (for all languages):
  • GitHub: task_app.yaml
  • Raw: https://raw.githubusercontent.com/synth-laboratories/synth-ai/main/synth_ai/contracts/task_app.yaml
Key rules:
  • ENVIRONMENT_API_KEY must match the X-API-Key header on /rollout requests.
  • Your /rollout handler:
    • Reads the prompt candidate from the request payload.
    • Runs it against your task (e.g., Banking77 classifier).
    • Returns per-sample rewards and aggregate metrics in the response.
See also: polyglot walkthroughs in the cookbooks repo.