Agentic email-support orchestration on Camunda 8 Self-Managed. An inbound customer email triggers a process that first checks domain scope, then fetches prior conversation context, queries a RAG knowledge base, lets an agent decide, and either resolves the case autonomously or escalates to a human — with the resolution saved back to long-term memory. An "Agent as a Judge" step evaluates each interaction and routes the outcome.
Blueprint: https://marketplace.camunda.com/en-US/apps/522492/ai-email-support-agent
The upstream blueprint targets Camunda 8.8. This repository runs on both, and is currently developed against 8.10-SNAPSHOT.
| Version | Status |
|---|---|
| 8.10-SNAPSHOT | Full flow runs end to end, including the agent-instance history writes. Current target. |
| 8.8.x (8.8.33 / connectors 8.8.15) | Full flow runs end to end. |
An earlier 8.10-SNAPSHOT image pair failed at the AI Agent connector's history
write with 400: Request property [loopIteration] cannot be parsed. That was a
version skew, not a defect in this repository: AgentInstanceHistoryItem
renamed iteration to loopIteration, and the connectors-bundle and
camunda SNAPSHOT images are published on separate build pipelines, so a pair
straddling that rename disagrees on the field name. Current images are aligned
and the error no longer reproduces. Because SNAPSHOT tags roll, pin both images
by digest rather than relying on the tag.
- Inbound email — an IMAP inbound connector polls for unseen mail. Messages
with no
In-Reply-Toheader start a new case; replies correlate back into a waiting instance by message id. - Domain-scope guardrail — a DMN decision classifies the email by keyword
before any LLM call.
OUT_OF_SCOPEroutes straight to an escalation end event, so off-domain requests never reach the agent. - Long-term memory —
fetch-past-conversationsloads the sender's prior interactions from their own Elasticsearch index, keyed by email address, and injects them into the agent's context. - Agent loop — an AI Agent ad-hoc sub-process reasons over the request and selects its own tools: query the RAG knowledge base, ask the customer a follow-up by email, or hand control to a loan specialist. The loop runs until the agent answers or hits its call limit.
- Retrieval —
query-knowledge-baseembeds the agent's query and runs kNN against a dense-vector index, returning hits above a cosine floor. A miss routes the agent down the "knowledge base empty" path instead of inventing an answer. - Write-back — the resolved interaction is embedded and stored in the customer's conversation index, so the next email from that address arrives with history.
- Agent as a Judge — a second agent evaluates the exchange and returns a verdict: resolve autonomously and email the customer, send for manual review, or escalate to human control.
| Path | What it is |
|---|---|
process/bpmn/ |
The BPMN process definition and its embedded agent/judge prompts |
process/dmn/ |
DMN decision table (domain-scope guardrail) |
workers/ |
Spring Boot job workers (Java 21): fetch-past-conversations, query-knowledge-base, save-customer-interaction, save-to-knowledge-base; RAG + Elasticsearch dense-vector logic; PII redaction guardrail |
services/llm-stub/ |
Local LLM stub the flow calls in place of a paid LLM. Drives the agent's tool call and returns the judge's verdict JSON |
services/embeddings/ |
all-mpnet-base-v2 sentence-transformers embedding service |
images/ |
Diagrams used by this README |
LIFECYCLE.md |
Versioning and rollback procedure |
The Docker Compose file and all secrets are intentionally not committed. The repo versions code and process definitions; the running stack is assembled locally from the official Camunda images.
- Out-of-scope rejection (deterministic) —
process/dmn/domain-scope-guardrail.dmnclassifies each inbound email by keyword before any LLM call. A DMN business rule task runs first; a gateway routesOUT_OF_SCOPEmessages to an escalation end event, so off-domain requests never reach the agent. Deterministic and provable, independent of the LLM. - Agent as a Judge — every interaction is evaluated, and the verdict routes the case to autonomous resolution, manual review, or human control.
- Operate — process and task state, DMN decision evaluations, and the AI Agent panel showing the agent instance's conversation and status
- Optimize — heat maps and analysis (
zeebe-record-*via the exporter)
Built on Camunda 8 and the AI Email Support Agent blueprint from the Camunda Marketplace. The orchestration patterns and the BPMN foundation are Camunda's; the guardrails (PII redaction, DMN domain-scope classifier), workers, supporting services, and documentation are original additions authored for learning and demonstration.
The original contributions in this repository are released under the MIT
License (see LICENSE) — in the same open spirit that Camunda shares its
blueprints. Camunda's platform, connectors, and original blueprint BPMN remain
Camunda's and are governed by Camunda's own license terms.



