Home / SAP Joule Guide / Governance & Trust

How to Test and Govern Joule Agents in Production

Test strategy, evaluations, human-in-the-loop, hallucination controls and a clean Dev → QA → Prod path for Joule agents.

Governance & Trust9 min readUpdated Dec 2026
TL;DR
  • Test agents like software: a fixed set of test cases with expected outcomes, rerun after every change.
  • Control hallucination with tight instructions, trimmed data and “say what’s missing” rules, not hope.
  • Run scheduled evaluations after go-live to catch drift, and keep humans approving anything that changes data.

Building a demo agent takes days. Keeping it accurate and safe in production is the real work. SAP has said publicly that a commerce customer who built over 50 agents found it had a governance problem. Here’s how to avoid that from agent one.

Test strategy

1. Action testsEach API action returns correct data for known keys. No AI involved.
2. Agent testsPrompts plus expected answers: right tools called, right numbers, right recommendation.
3. Negative testsWrong IDs, missing data, unauthorised users, prompt-injection attempts.
4. User acceptanceReal users on real cases, with every answer scored as right, partly right or wrong.

Keep 20–50 test cases per agent in a simple sheet, and rerun them after every change to instructions, tools or model.

Evaluations and drift

Agents change behaviour when data, APIs or underlying models change. SAP’s AI Agent Hub in Joule Studio runs post-deployment agent evaluations on a schedule to detect drift. Pair that with your own checks:

  • Accuracy rate: the share of answers users accept without correction
  • Tool-call pattern: sudden jumps in actions per task (which also raises AI Unit cost)
  • Escalations: how often the agent says “I can’t” or hands back to a human
  • Latency: time to answer, which often signals oversized API responses

Human-in-the-loop

SAP leaves the level of autonomy to each customer. A sensible ladder:

LevelAgent doesHuman does
1. InformFinds and summarisesDecides and acts
2. RecommendProposes an action with reasonsApproves or rejects
3. Act with approvalPrepares the transactionConfirms before posting
4. Act within limitsActs below a thresholdReviews exceptions and samples

Start every agent at level 1 or 2. Move up only with data showing high accuracy.

Hallucination controls

  • Ground every number: instruct the agent to quote figures only from tool results.
  • Allow “I don’t know”: add a rule to state what data is missing instead of guessing.
  • Trim inputs: smaller, relevant API responses reduce confusion.
  • Use documents carefully: ground on current, owned documents only.
  • Structured output: ask for a fixed format (decision, reason, key figures) that’s easy to check.

Dev → QA → Prod

  1. Separate environmentsDev, QA and Prod subaccounts, each pointing at the matching S/4HANA system.
  2. Same destination name everywhereUse one destination name per environment, so agents move without edits.
  3. Version everythingInstructions, tools and test cases. Know exactly what changed between releases.
  4. Gate releases on testsPromote only when the regression test set passes in QA.
  5. Pilot, then widenRelease to a small group first, watch the metrics, then expand.

Monitoring with AI Agent Hub

SAP AI Agent Hub automatically registers every agent built in Joule Studio as a distinct entity, giving you one portfolio view. Use it to answer: which agents exist, who owns each, what they cost, and whether they still perform. Retire agents nobody uses. Agent sprawl is a cost and a risk.

Frequently asked questions

How do you test a Joule agent?

Test the API actions first, then run a fixed set of prompts with expected answers, plus negative tests and user acceptance on real cases. Rerun the set after every change.

How can I reduce hallucinations in Joule agents?

Ground figures in tool results only, allow the agent to say what data is missing, trim API responses, and ask for a structured output.

What is SAP AI Agent Hub?

A part of Joule Studio that registers every custom agent, gives a portfolio view, and runs scheduled evaluations to detect drift.

Keep reading

Want this built in your landscape?

We design and ship Joule agents on S/4HANA, from API layer to production.

Book a Discovery Call
© 2026 erpai.blogSAP, S/4HANA and Joule are trademarks of SAP SE. Screens show illustrative sample data.