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.
The two processes
Section titled “The two processes”| Process | Repo | Port | Command |
|---|---|---|---|
| Playground API | plnt | 8080 | plnt playground up |
| Site (Astro) | plnt-site | 4321 | npm run dev |
CORS is already open for http://localhost:4321 — no proxy, no rewrite, no --host flag hackery. The browser can talk to both.
1. Start the API
Section titled “1. Start the API”cd plnt/source .venv/bin/activateplnt playground upForeground process on http://127.0.0.1:8080. Verify:
curl -s http://127.0.0.1:8080/v1/models | jq2. Point the site at it
Section titled “2. Point the site at it”In another terminal:
cd plnt-site/PUBLIC_PLNT_ENDPOINT=http://127.0.0.1:8080 npm run devOpen http://localhost:4321/playground. The chat panel:
- Fetches
/v1/modelson load — you’ll see whatever is in the API’s registry. - Sends
POST /v1/chat/completionswhen you hit Send. - Falls back to canned “stub” replies if the fetch fails, so the UI keeps working even when the API is down.
Troubleshooting
Section titled “Troubleshooting”If you see the stub reply and expected a real one, check:
- API is up.
curl -s http://127.0.0.1:8080/healthzshould return{"status":"ok"}. - CORS. Open DevTools → Network → look for a red preflight (
OPTIONS) request. IfAccess-Control-Allow-Originis missing,PLNT_PLAYGROUND_CORS_ORIGINSin the API’s env may have been set narrower than expected. Unset it and restart the API. - 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 returns404 workflow not registered.
3. Load the site’s workflow set locally
Section titled “3. Load the site’s workflow set locally”If you want the local API to accept the site’s default workflow ids, mount the matching registry:
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 upNow /playground in the site can select any of the four workflows and get a live (mock) invocation back through the API.