Design a Prompt Playground
Design a collaborative prompt experimentation product with immutable versions, reproducible runs, searchable results, and safe model-provider execution.
Problem statement
For this exercise, assume teams use a prompt playground to create prompt projects, publish immutable prompt versions with typed variables, assemble versioned test-case sets, select an approved model-configuration snapshot, execute experiments, and compare outputs.
One accepted run is bound to exact prompt, test-set, model-configuration, and parameter versions so results remain reproducible even when those inputs later change. Model calls are asynchronous, may stream, and may time out after taking effect; provider credentials and quotas are tenant scoped.
Users need low-latency project and history reads plus filters by workspace, project, prompt version, model configuration, creator, status, and time. Design the product APIs, database schema and indexes, execution system, result storage, authorization and share links, failure recovery, and observability.
Model training, production inference serving, automatic truth judging, prompt marketplaces, and provider onboarding are outside scope.
For this exercise, prompts may be large and shared with authorized workspace members. Explain the cost of saving a version after an edit of only one or two characters: compare full immutable snapshots with delta or chunk-based storage, database metadata with object bodies, and bounded reconstruction.
Preserve the exact text and access rules of every version used by a run; no storage encoding is mandated.
For this exercise, a member can also share one published prompt version through a read-only link that anyone holding it can open without signing in, and can revoke that link at any time.
After a revoke succeeds, new requests through the link must be refused within the revocation target below, even if a CDN (content delivery network: servers close to viewers that keep copies of responses) or a server-side cache still holds a copy. A page a viewer has already loaded cannot be taken back.
What to build
- Workspace members can create prompt projects, publish immutable prompt versions with typed variables, inspect version history, and share a published version through a read-only link they can revoke.
- Workspace members can create immutable test-case-set versions whose cases supply variable values and optional human reference notes.
- A user can idempotently start an experiment bound to exact prompt, test-set, model-configuration, and parameter snapshots and observe durable per-case outcomes.
- Authorized users can search run history, inspect attempts and outputs, and compare completed runs without exposing another workspace's prompts, credentials, or results.
At scale
- For this exercise, assume 50,000 workspaces, 10 million immutable prompt versions, and 100 million retained test-case definitions with highly skewed team activity.
- For this exercise, support 200 experiment starts per second, up to 500 cases per run, and provider quotas that may be smaller than admitted demand; one popular share link may receive 2,000 views per second.
- For this exercise, target 300 milliseconds p95 for healthy project and run-history reads and 500 milliseconds p95 to durably accept a run before asynchronous execution.
- For this exercise, retain run outputs for 90 days and prompt, configuration, authorization, and run audit metadata for one year; a zone failure must not lose accepted runs or publish partial results as complete, and a revoked share link must stop serving new requests within 60 seconds.