D Diagent docs

Build your agent

Playground

The Playground at /app/agents/{id}/playground is a full sandbox for testing your agent before publishing. Conversations here are flagged is_playground and never count toward your billing meter, conversation analytics, or the Inbox.

What you can test

  • Site type โ€” switch between ecommerce, saas, documentation, help_center, marketing, internal_kb, or generic without mutating the agent's persisted column. Useful for "what would my agent say if treated as ecommerce vs documentation?".
  • Page context โ€” paste a URL and metadata (title, description, og tags, JSON-LD, h1/h2, visible body text) so the agent answers as if the visitor were on a specific page. Six ready-made templates (Shopify product, SaaS pricing, Docusaurus docs, help-center article, marketing landing, blank) cover the common shapes.
  • Reply language โ€” pick any locale the workspace ships translations for (132 by default, auto-discovered from lang/*.json). Useful for sanity-checking that the agent answers in the right language and that RTL scripts mirror.
  • Sample prompts โ€” buyer-realistic test prompts per vertical (5โ€“6 chips per site type) so you can fire a typical question with one click.
  • Compare mode โ€” toggle to split the chat into two columns and run the same question against two different site types side-by-side. The differentiator for picking the right vertical.

Right-pane tabs

Scenario

Site type override + reply language + sample prompts. The capability badges below the site-type select show which rich blocks (product_card, pricing_card, case_study_card, escalation_button) the selected vertical can emit.

Page context

Form-driven editor for the page_context the visitor would send. Use the Use template dropdown to drop in a realistic Shopify product page or Stripe pricing page, then tweak the URL / title / og fields. JSON-LD accepts pasted JSON.

Diagnostics

Read-only inspection of the last turn:

  • Latency โ€” first-token and total time.
  • Confidence โ€” the strongest grounding signal (retrieval similarity OR page-context baseline 0.85).
  • Retrieved sources โ€” top-k chunks with both ANN and rerank scores plus a snippet, ordered as the LLM saw them.
  • Tool calls โ€” every server-side tool fired during the turn, with arguments.
  • Inline blocks โ€” count and types of rich blocks the LLM emitted (e.g. product_card).
  • System prompt โ€” the full system message used, including the vertical fragment and any custom system prompt. Click to expand.

Endpoints

All three are session-authenticated and scoped by AgentPolicy::update:

  • GET /app/agents/{agent}/playground โ€” Inertia render with the verticals preview map keyed by slug.
  • POST /app/agents/{agent}/playground/stream โ€” SSE stream. Body: {message, conversation_id?, site_type_override?, language_override?, page_context?}. Emits start, retrieval, prompt, token, block, tool_call, done events.
  • POST /app/agents/{agent}/playground/reset โ€” clears the cached conversation history. Body: {conversation_id}.

Notes

  • Playground turns reuse the same Redis history key as production widget conversations. Reset is the explicit way to start from an empty context โ€” closing the tab leaves history in place for two hours.
  • Site-type and language overrides do not mutate the agent's persisted columns. Once you've found the combination that works, head to Site type in the agent's settings to save it.
  • Page-context payloads are sanitized server-side identically to the visitor widget โ€” same key allow-list, same 8 KB cap, same canonical-URL collapse.