Open MercatoDocsSearch docsAPI reference

Agents and AI

Run an agent in Playground

Give the Deal health check agent a fictional deal and it will propose a next pipeline stage. In Playground you can inspect its reasoning and the proposed action before connecting a run to a workflow that updates a record.

From Playground, select an agent and supply JSON input. Inspect model calls, tokens, latency and cost in the run trace.
Test a configured agent in Playground, then open its trace to inspect the model calls recorded for that run.

Before you open Playground

Use a deployment licensed for Open Mercato Enterprise. In the 0.10.0 standalone template, the module registry checks both OM_ENABLE_ENTERPRISE_MODULES and OM_ENABLE_ENTERPRISE_MODULES_AGENTS. On a development instance, set both to true, regenerate the registry with yarn generate, apply the module migrations to that instance and restart the app. Your selected runtime also needs a configured model provider. Keep provider credentials in your deployment's secret configuration.

Your role needs agent_orchestrator.agents.view to browse agents and agent_orchestrator.agents.run to invoke one in Playground. Trace access and proposal review have their own permissions. An administrator can grant the narrow features needed for each job.

Run a deal health check

  1. Open Agents in the admin sidebar and choose Playground. The backend route is /backend/playground.
  2. Choose Deal health check (deals.health_check). Choose Insert sample to restore the agent's example, or paste the fictional record below into Input (JSON).
  3. Select Run. Under Proposal result, inspect the proposed set_stage action, its rationale and its confidence. This example supplies the deal inline, so the agent can assess it without fetching a customer record.
  4. Change just recentActivity to “The buyer canceled the pilot and is reviewing next year's budget.” Run it again. Compare the evidence the agent cites. The recommendation and confidence can vary by model and run.
{
  "deal": {
    "id": "demo-north-01",
    "name": "Northlight pilot",
    "stage": "Proposal",
    "value": 24000,
    "probability": 0.65,
    "daysInStage": 8,
    "recentActivity": "The buyer approved the pilot scope and scheduled a procurement review."
  }
}
Agent Orchestrator Playground with Deal health check selected, the JSON input editor, Insert sample and Run.
Choose an agent, inspect its sample input, then use Run to test it. This product QA capture uses the Deal health check agent.

Inspect the run and decide who acts

Tools used distinguishes a tool the agent could use from one it actually called. View trace opens run details for users with agent_orchestrator.trace.view. The Playground run can store a proposal. Applying a proposal to the business record requires an action that performs that change.

On a test tenant seeded with examples, open the workflow definition Deal Health Check (Agent). Its agent step assesses the deal, a policy decides whether it needs human review, and a later step applies the approved stage through the Customers command. The example sets its automatic approval threshold to 0.8. An operator handles proposals awaiting a decision in Agents → Caseload. Use a disposable deal for this workflow test, since the final step can update it.

Model calls panel with rows for provider and model, parameters, tokens, cost, latency, finish reason and fidelity.
Each row represents one model call. Compare latency and token counts across the calls in the same run.

Add your own agent

In this release, the agent registry reads definitions from code. Look at src/modules/agent_examples/ in the standalone starter for file-defined agents and example tools. Declare the expected input, result and permissions, regenerate the registry, then repeat the Playground test with representative cases before attaching the agent to a workflow.

Go further

Deal health check definition · Example approval workflow · Agent access features · Example agent module

Previous: Give a role access to the right records · Next: Receive stock from a supplier