Open MercatoDocsSearch docsAPI reference

Framework

AI Playground

The AI Assistant playground lets a developer exercise a registered chat or structured-output agent before embedding it in a page. Choose the agent, send a representative input, then use the debug panel to inspect what the runtime received and returned.

The playground is the fastest way to exercise a registered agent end-to-end without wiring a host page. It supports both chat and object execution modes and ships a debug panel that mirrors the panels the Code Mode Command Palette exposes.

Open at /backend/config/ai-assistant/playground. Requires the ai_assistant.settings.manage feature.

Agent picker

Every agent aggregated into ai-agents.generated.ts shows up in the picker. The selection drives:

Chat mode

When the picked agent declares executionMode: 'chat' (the default), the playground renders an <AiChat> instance with:

Object mode

When the picked agent declares executionMode: 'object', the playground swaps the chat for a JSON input editor and a result panel. The runtime validates the returned object against agent.output.schema and surfaces violations inline.

Debug panel

The panel shows the resolution the dispatcher used for the current session:

The visible task plan and LoopTrace serve different audiences. The task plan is live operator-facing progress copy; it appears during a turn and must never contain private reasoning. LoopTrace is a debug-only, post-turn execution trace for developers and admins.

When a tenant has flipped the Disable agentic loop kill switch from Settings, the playground (and any <AiChat> instance for that agent) renders a LoopDisabledBanner above the composer and the dispatcher collapses the agent to a single model call.

Use the panel to confirm that a newly-saved prompt or loop override reached the runtime without restarting anything.

Shortcuts

The playground reuses the shared <AiChat> shortcut set:

ShortcutAction
Cmd/Ctrl + EnterSend the current message (or submit the JSON in object mode)
EscapeAbort the in-flight request
Shift + EnterInsert a newline inside the message

When to use the playground vs <AiChat>

Manual QA route

Use this route after changing task plans, tool streaming, or prompt guidance:

  1. Open /backend/config/ai-assistant/playground and pick customers.account_assistant or customers.deal_analyzer.
  2. Ask: Find deals assigned to Joe and summarize the useful matches.
  3. Verify the visible plan appears before the CRM tool result finishes, the matching step advances from pending or running to done, and the raw meta.update_task_plan tool row is not shown as an operator task. Catalog agents stay quiet by default unless you opt them in with taskPlan: { enabled: true }.
  4. To cover the error path, temporarily remove a required CRM tool from the picked agent via a local prompt/tool override or use a test provider stub that returns a tool error. Send the same prompt and verify the matching plan row becomes failed while the final assistant text still renders.

Choose the playground for the job

This AI Assistant settings page runs chat and object-mode agents. To run Enterprise Deal health check and review the resulting proposal, use Agents → Playground at /backend/playground. Follow Run an agent in Playground for the full example.

Previous: AI Framework Overview · Next: Agent Settings