Skip to content

Local dev

Run the plnt playground API and the plnt.work site on the same laptop. The site’s chat panel talks to the API via PUBLIC_PLNT_ENDPOINT and CORS is pre-configured for the Astro dev port.

ProcessRepoPortCommand
Playground APIplnt8080plnt playground up
Site (Astro)plnt-site4321npm run dev

CORS is already open for http://localhost:4321 — no proxy, no rewrite, no --host flag hackery. The browser can talk to both.

Terminal window
cd plnt/
source .venv/bin/activate
plnt playground up

Foreground process on http://127.0.0.1:8080. Verify:

Terminal window
curl -s http://127.0.0.1:8080/v1/models | jq

In another terminal:

Terminal window
cd plnt-site/
PUBLIC_PLNT_ENDPOINT=http://127.0.0.1:8080 npm run dev

Open http://localhost:4321/playground. The chat panel:

  • Fetches /v1/models on load — you’ll see whatever is in the API’s registry.
  • Sends POST /v1/chat/completions when you hit Send.
  • Falls back to canned “stub” replies if the fetch fails, so the UI keeps working even when the API is down.

If you see the stub reply and expected a real one, check:

  1. API is up. curl -s http://127.0.0.1:8080/healthz should return {"status":"ok"}.
  2. CORS. Open DevTools → Network → look for a red preflight (OPTIONS) request. If Access-Control-Allow-Origin is missing, PLNT_PLAYGROUND_CORS_ORIGINS in the API’s env may have been set narrower than expected. Unset it and restart the API.
  3. Workflow id. The site’s default catalog uses review-responder, post-generator, booking-triage, competitor-monitor. If the API’s registry uses different ids, the invocation returns 404 workflow not registered.

If you want the local API to accept the site’s default workflow ids, mount the matching registry:

Terminal window
cat > /tmp/site-workflows.json <<'EOF'
[
{"id": "review-responder", "backend": "mock", "runtime": "microagent"},
{"id": "post-generator", "backend": "mock", "runtime": "microagent"},
{"id": "booking-triage", "backend": "mock", "runtime": "microagent"},
{"id": "competitor-monitor", "backend": "mock", "runtime": "microagent"}
]
EOF
PLNT_PLAYGROUND_CONFIG=/tmp/site-workflows.json plnt playground up

Now /playground in the site can select any of the four workflows and get a live (mock) invocation back through the API.