Skip to content

examples(inference): editable system prompt + "Open in Builder" + Sonic-3 / 4.1-mini defaults#5776

Merged
JackNDwyer merged 2 commits into
mainfrom
jack/grw-549/lightweight-builder-playground
May 19, 2026
Merged

examples(inference): editable system prompt + "Open in Builder" + Sonic-3 / 4.1-mini defaults#5776
JackNDwyer merged 2 commits into
mainfrom
jack/grw-549/lightweight-builder-playground

Conversation

@JackNDwyer
Copy link
Copy Markdown
Contributor

Summary

Turns the Inference example into a lightweight agent-builder playground that pairs with the corresponding Jukebox PR (livekit/agents-jukebox#TODO).

  • Editable system prompt. Adds a set_system_prompt RPC that rewrites agent.instructions live. Deduped against the current value so the per-keystroke fires from the frontend don't spam update_instructions.
  • "Open in Builder" CTA. New type: link control in the YAML with an href_template that opens Cloud Builder pre-populated with the current instructions (URL-encoded), llm, stt, tts, and modelMode=pipeline. project_id is the p_ placeholder so Cloud routes through login when needed and preserves the params on redirect.
  • Live transcript view. Adds a views[].source: transcript entry; the Jukebox frontend renders LiveKit TranscriptionReceived segments into the existing view-card slot — no agent-side push needed.
  • Defaults bumped. cartesia/sonic-2cartesia/sonic-3, openai/gpt-4o-miniopenai/gpt-4.1-mini, both in playground.yaml and the agent's DEFAULT_* constants. Seed INSTRUCTIONS aligned with the textarea's default so the first session matches what the user sees before any edit.

YAML schema also picks up doc comments for the new textarea / link control types and the transcript view source — the Jukebox PR has the corresponding parser + renderer changes.

Test plan

  • cd examples/inference && python agent.py dev — connect via Jukebox playground; verify prompt edits land (system prompt updated (N chars) in agent logs) and the agent's behaviour changes within a turn.
  • Pick a new STT / LLM / TTS — confirm the model swap still works after the prompt-editing changes.
  • Click "Open in Builder" — confirm a Cloud Builder URL opens in a new tab with instructions, llm, stt, tts, and modelMode=pipeline matching the current Playground state.
  • Default-only session (no edits) — verify the agent's initial prompt matches the textarea's seed.

Made with Cursor

…ic-3 / 4.1-mini defaults

Adds a `set_system_prompt` RPC to the inference agent so the Playground
textarea can rewrite the agent's instructions live (deduped against the
current value to avoid logspam on every keystroke). The YAML gains a
`textarea` system-prompt control, a `link`-type "Open in Builder" CTA
that deep-links into Cloud Builder with the current prompt + STT/LLM/TTS
preserved as URL params, and a `transcript` view source. Defaults bumped
to `cartesia/sonic-3` and `openai/gpt-4.1-mini` in both the YAML and the
agent's DEFAULT_* constants, with the seed prompt aligned between
INSTRUCTIONS and the textarea default so first-session behavior matches
what the user sees in the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@chenghao-mou chenghao-mou requested a review from a team May 19, 2026 20:49
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Comment thread examples/playground.yaml Outdated
Comment on lines +288 to +292
- rpc: open_in_builder
type: link
label: "Open in Builder \u2192"
primary: true
href_template: "https://cloud.livekit.io/projects/p_/agents/builder/new?modelMode=pipeline&instructions={inference/set_system_prompt}&llm={inference/set_llm_model}&stt={inference/set_stt_model}&tts={inference/set_tts_model}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an RPC? And it open the URL that the agent is returning?

So you don't need any template

Replaces the frontend's `href_template` substitution with an
`open_in_builder` RPC the agent answers with the fully-built URL. The
agent already knows its current instructions, llm, stt and tts model
strings — so the templating + URL-encoding belongs there rather than in
the wasm frontend. Drops `href_template` from the YAML and updates the
`type: link` docs to reflect the new "fire RPC → open returned URL"
semantics.

Per Theo's review on #5776.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JackNDwyer
Copy link
Copy Markdown
Contributor Author

Done in ac54637 (agents) + livekit/agents-jukebox#10 343c8a6 (jukebox).

open_in_builder is now an RPC on the agent — it reads its own instructions + the live session.{stt,llm,tts}.model and returns the Cloud Builder URL. The YAML loses href_template and the jukebox loses the whole template-substitution + URL-encoder block; type: link controls now just fire the RPC and open whatever URL the agent returns.

One bit of glue: window.open() only escapes the popup blocker when called synchronously inside a click handler, so the jukebox side cracks about:blank open on click and assigns .location once performRpc resolves (closing the blank tab on failure so the user isn't stranded). Net it's still a single click, just routed through the agent.

@JackNDwyer JackNDwyer merged commit 22d41a4 into main May 19, 2026
22 of 23 checks passed
@JackNDwyer JackNDwyer deleted the jack/grw-549/lightweight-builder-playground branch May 19, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants