A job worker has a contract. Give it order 4711 and it returns the same dispatcher and dispatch date every time, and a unit test checks exactly that. The AI agent that calls this worker has no such contract: ask it twice where order 4711 is and you get two replies with different wording, and nothing in the build stops one of them from mentioning a delivery date the worker never returned.
That makes the agent the easiest part of a process to break without noticing. Someone refines the wording in the system prompt, switches to a cheaper model or edits a tool description. The BPMN still deploys and every test stays green, and the reply might now be in the wrong language or promise a discount nobody approved.
Since 8.9, Camunda Process Test has a second model for this, the judge. It reads what the agent produced and grades it against an expectation you write in plain language. In this article I add judge tests to the support agent from my example repo, with STACKIT AI Model Serving running both the agent and the judge.
Why assertEquals Doesn’t Work For Agents
The example is a customer support agent for a fictional online shop. An AI Agent sub-process gets the customer’s request, and a human reviews the drafted reply in a user task before anything goes out.
The agent has three tools. Get customer and Get order status are job workers with sample data. Ask support team is a user task, so when the agent is unsure, a human answers and the answer goes back to the model as the tool result. The repo already had tests: mvn verify checks the BPMN statically and the job workers in plain unit tests, without Docker or a model. Those catch a broken mapping or a worker that returns the wrong order. They never see what the agent does with the data.
What the agent should do lives in the system prompt: never invent order data, ask the support team when unsure, answer in the customer’s language, briefly and politely. Each rule is a requirement written as text. You can’t assertEquals politeness, and a check for “DHL” in the reply also passes on “it was not shipped with DHL”.
The model is part of the behaviour too. The example takes it as a process variable, so one instance can run on gpt-oss-20b and the next on gpt-oss-120b, and without tests only reading the replies tells you whether the other model still follows the rules.
What Camunda Process Test Brings
Camunda Process Test (CPT) starts Camunda in Testcontainers. With connectors-enabled, it starts the connectors bundle next to it, so the real AI Agent connector runs and calls the real model. Camunda’s docs on testing agents recommend exactly that split: keep the agent and the model real, and control the tools. In the example, the job workers run in the test JVM with fixed sample data, so the tool side is deterministic already. The human tool gets its answer from a conditional behaviour, which you register before the instance starts and which completes Ask support team when that task becomes active. If the agent never picks the tool, it never fires.
Then come the judge assertions. hasVariableSatisfiesJudge and hasLocalVariableSatisfiesJudge take a variable and an expectation. The judge model gets both and returns a short reasoning and a score between 0.0 and 1.0, with anchors at 1.0, 0.75, 0.5, 0.25 and 0.0. The assertion passes if the score reaches the threshold, 0.5 by default, which the docs describe as “at least partially satisfied”.
The judge evaluates the expectation once. The assertion timeout only covers waiting until the variable exists, so a low score fails right away, without a retry. A failure prints the expectation, the actual value, the score against the threshold and the judge’s reasoning, and that reasoning is the first thing to read when a test goes red.
The other option is hasVariableSimilarTo. It turns the variable and a reference text into embeddings and compares them by cosine similarity. That needs an embedding model, configured separately, and costs less than a judge call. But similarity measures how close a reply is to an example answer, not whether it follows a rule: a reply with an invented delivery date still sounds like the reference, and you get a number without reasoning. I’d use similarity for replies with one expected shape and the judge for every “must not”.
STACKIT As Agent And Judge
Both models in the test talk to the same OpenAI-compatible endpoint at STACKIT, with the same API token. You create the token with the STACKIT CLI:
stackit curl -X POST \
https://model-serving.api.eu01.stackit.cloud/v1/projects/<project-id>/regions/eu01/tokens \
--data '{"name":"camunda-ai-agent","ttlDuration":"336h"}'STACKIT shows the token content once. It’s a bearer token for your whole model serving project, valid for 14 days here, so plan the rotation. To see which models your token can use, call /v1/models on the endpoint below.
The agent side is configuration on the AI Agent sub-process (v2 template). It uses the OpenAI provider with a custom backend and the Chat Completions API, which the docs recommend when a compatible backend doesn’t support Responses.
The endpoint is https://api.openai-compat.model-serving.eu01.onstackit.cloud/v1, and the connector appends /chat/completions to it. The model field holds =if is defined(model) then model else "openai/gpt-oss-120b", so an instance without a model variable runs on gpt-oss-120b.
In production, the key comes from STACKIT Secrets Manager through the secret provider from last week. The judge side is CPT configuration, shown in the next section.
Which Models To Pick
The agent needs a model with tool calling, which on STACKIT covers most of the chat models in eu01: the two gpt-oss models, a Llama 3.3 70B, Gemma 4 and two Qwen models. The example runs the agent on gpt-oss-120b, the larger gpt-oss model, because the agent does the hard part: it picks the tools, fills their parameters and decides when to ask a human.
The judge doesn’t call tools. It reads an expectation and a string and grades the match. Camunda’s docs on testing agents say the judge doesn’t need the same model as the agent, and that a lighter model often works well because its context is much smaller. So the example uses gpt-oss-20b as the judge, at 0,15 € instead of 0,45 € per million input tokens as of November 2026. A different model than the agent’s also helps, since a model grading its own output shares its blind spots. Set the judge’s temperature to 0, which makes the grade more stable. If the judge passes replies you would reject, read its reasoning first, then try a stronger judge through JUDGE_MODEL before you rewrite the expectations.
STACKIT bills per day and model, in units of one million tokens, so a single test run is billed as a full million on both models.
Setting Up The Tests
The test dependency is camunda-process-test-spring in test scope. It brings CPT with Testcontainers and the LangChain4j adapter the judge runs on. The rest is a Spring profile:
camunda:
process-test:
camunda-docker-image-version: 8.10.9
connectors-enabled: true
connectors-docker-image-name: camunda/connectors-bundle
connectors-docker-image-version: 8.10.5
connectors-secrets:
STACKIT_AI_API_KEY: ${STACKIT_AI_API_KEY}
assertion:
timeout: PT2M
judge:
threshold: 0.75
chat-model:
provider: openai-compatible
base-url: https://api.openai-compat.model-serving.eu01.onstackit.cloud/v1
api-key: ${STACKIT_AI_API_KEY}
model: ${JUDGE_MODEL:openai/gpt-oss-20b}
temperature: 0.0
timeout: PT60Sconnectors-secrets hands the key to the connectors container, where {{secrets.STACKIT_AI_API_KEY}} in the BPMN resolves it. The assertion timeout is two minutes, because one agent run makes several model calls. The threshold is 0.75, stricter than the default 0.5.
A test case reads like any other CPT test. This one asks about the discount, which the agent isn’t allowed to decide on its own:
@Test
void test_agent_asks_support_team_about_discount_with_context_as_expected() {
// given
supportTeamAnswers("We cannot grant 20%. Offer a 10% voucher for the next order, code SORRY10.");
// when
ProcessInstanceEvent instance =
start("My order 4712 is taking forever. I want a 20% discount on it.");
// then
assertThat(instance)
.hasActiveElements(REVIEW_REPLY)
.hasCompletedElements(ASK_SUPPORT_TEAM)
.hasLocalVariableSatisfiesJudge(ASK_SUPPORT_TEAM, "question", """
The question asks the support team whether the customer can get a 20% discount \
on order 4712. It gives enough context to answer without further lookups, at \
least the order id and the customer's request.""")
.hasLocalVariableSatisfiesJudge(REVIEW_REPLY, "reply", """
The reply offers a 10% voucher for the next order with the code SORRY10. \
It does not promise a 20% discount. It is in English and brief.""")
.hasLocalVariableSatisfiesJudge(REVIEW_REPLY, "reply", POLITE);
}supportTeamAnswers registers the conditional behaviour for the human tool, and hasCompletedElements checks that the agent actually asked. CPT has no agent-specific assertions; a tool call is an element like any other. The test class carries @EnabledIfEnvironmentVariable on the key, so without a token it’s skipped instead of failing.
The judge tests are *IT classes behind a Maven profile judge that adds the failsafe plugin. The default mvn verify stays offline, and the judge run is explicit:
set -a; source .env; set +a
mvn -Pjudge verifyWriting Expectations
Start from the system prompt, where each rule is a test case: use the tool data, invent nothing, answer in the customer’s language, ask when a decision isn’t yours, stay polite. The repo turns that into four cases.
With gpt-oss-120b as the agent and gpt-oss-20b as the judge, all four pass in my runs.
An expectation is a prompt for the judge, and the same habits apply. Name the facts from the tool data that must show up, and name what must not: “shipped with DHL, arriving 14 November, no other carrier, status or date”. The second half catches the invented data, which is the failure that matters most in a support reply. Keep one concern per assertion, too. In the example every case has a separate politeness check, so a correct but curt reply fails on its own and the reasoning tells you which rule broke.
Judge the intermediate text as well as the final reply. The question the agent writes to the support team is the output of a fromAi prompt, and if it lacks the order number, a human has to look it up. The test above catches that.
Running In CI
Judge tests cost tokens, and model output varies between runs, so I wouldn’t gate every pull request on them. The repo keeps the regular build without a key and proposes a separate workflow that runs on demand, nightly on weekdays and on pull requests labelled judge. The key sits in a GitHub environment, optionally with required reviewers, and the token is a dedicated one with a short lifetime.
Without the secret the tests skip, so a misconfigured workflow shows up as “0 tests run”. A single red run means reading the judge’s reasoning and running again before you touch the prompt or the expectation. The nightly run is a trend signal for prompt and model changes; I wouldn’t make it a required check.
What’s Next
Agent output is text and varies between runs, so it needs a judge instead of
assertEquals.Camunda Process Test runs the real AI Agent connector in Testcontainers, answers the human tool with a conditional behaviour and grades text with
hasLocalVariableSatisfiesJudge.STACKIT AI Model Serving serves agent and judge from one OpenAI-compatible endpoint and one token.
Give the agent the larger tool-calling model and the judge a smaller one at temperature 0.
Write expectations with the facts that must appear and what must not, one concern per assertion.
Keep judge tests out of the PR gate and run them on demand and nightly.
Fork the example, add your STACKIT project, run mvn -Pjudge verify, then break a rule in the system prompt on purpose and see which case notices.




