How it-at-m/zammad-ai works
Purpose and deployable units
Zammad-AI is an independently deployable GenAI middleware layer for Zammad support operations. It comprises a workflow/API service, a knowledge-base indexing job, and a content-safety service. Primary executable entry points are zammad-ai-workflow/main.py, zammad-ai-index/main.py, and slm-guardrails/main.py; local multi-service deployment is defined by compose.yaml.
Workflow service: ingress and orchestration
zammad-ai-workflow is the central long-running Python backend. Its HTTP backend exposes health, prompt-version, triage, and answer routes through zammad-ai-workflow/app/api/backend.py and zammad-ai-workflow/app/api/v1/triage.py / zammad-ai-workflow/app/api/v1/answer.py. It can also consume asynchronous ticket events through zammad-ai-workflow/app/kafka/broker.py. Both paths enter shared domain services rather than directly invoking integrations.
Triage and ticket action flow
Triage interprets ticket content with GenAI and business prompts, producing routing/classification data; core logic is in zammad-ai-workflow/app/triage/triage.py and zammad-ai-workflow/app/triage/genai_handler.py. Resulting automation is applied through zammad-ai-workflow/app/action/service.py. Zammad is an external system boundary, reached through REST and EAI adapters in zammad-ai-workflow/app/zammad/api.py and zammad-ai-workflow/app/zammad/eai.py.
Answer-generation and retrieval flow
Answer requests are coordinated by zammad-ai-workflow/app/answer/service.py; the agent path, response evaluation/repair, and retrieval sources are separated into zammad-ai-workflow/app/answer/agent.py, zammad-ai-workflow/app/answer/judge.py, and zammad-ai-workflow/app/answer/knowledgebase.py. The workflow queries Qdrant using models defined in zammad-ai-workflow/app/models/qdrant.py; retrieved knowledge is incorporated into model context. Prompt assets are versionable files under zammad-ai-workflow/prompts/answer/ and zammad-ai-workflow/prompts/triage/.
Knowledge-base indexing pipeline
zammad-ai-index is a separately run synchronization job that obtains Zammad knowledge-base data, processes documents, generates/indexes vector records, and writes them to Qdrant. Its main stages are represented by zammad-ai-index/job/zammad/api.py, zammad-ai-index/job/data/processing.py, and zammad-ai-index/job/qdrant/qdrant.py. This is the data-production boundary for answer retrieval; the workflow consumes indexed vectors rather than owning KB synchronization.
Safety and preprocessing boundaries
The workflow delegates prompt/response safety checks over HTTP through zammad-ai-workflow/app/guardrails/http_client.py. The separate slm-guardrails service implements label-based guardrail decisions in slm-guardrails/guardrail_app/guardrails/service.py and slm-guardrails/guardrail_app/guardrails/labels.py. Before model processing, structured/table content can be normalized by zammad-ai-workflow/app/preparser/service.py, isolating input transformation from triage and answer policies.
Runtime, infrastructure, and observability
All core services are Python applications packaged with service-specific Dockerfiles. External/runtime dependencies include Zammad, Kafka for event-driven processing, Qdrant for vector search, configurable GenAI providers, and Langfuse tracing via zammad-ai-workflow/app/observe/langfuse.py. Prometheus metrics configuration is represented in zammad-ai-workflow/app/settings/prometheus.py; local Prometheus/Grafana provisioning lives in observability/prometheus/prometheus.yml and observability/grafana/. An optional embedded Gradio-facing integration is contained in zammad-ai-workflow/app/frontend/integration.py.
Main entry points: service.py Answer service · triage.py Triage service · main.py Workflow entry point · backend.py HTTP API
Components 26
Workflow service
Long-running ticket automation and answer API.
- Workflow entry point
zammad-ai-workflow/main.py - HTTP API · Health, prompt-version, triage, and answer ingress.
zammad-ai-workflow/app/api/backend.py - Ticket event consumer
zammad-ai-workflow/app/kafka/broker.py - Triage service · Classifies and routes ticket content.
zammad-ai-workflow/app/triage/triage.py - Triage GenAI handler
zammad-ai-workflow/app/triage/genai_handler.py - Answer service · Coordinates answer generation.
zammad-ai-workflow/app/answer/service.py - Answer agent
zammad-ai-workflow/app/answer/agent.py - Answer judge
zammad-ai-workflow/app/answer/judge.py - Knowledge retrieval
zammad-ai-workflow/app/answer/knowledgebase.py - Ticket actions
zammad-ai-workflow/app/action/service.py - Zammad adapters
zammad-ai-workflow/app/zammad/api.py - Content preparser · Normalizes structured and table content.
zammad-ai-workflow/app/preparser/service.py - Guardrail client
zammad-ai-workflow/app/guardrails/http_client.py - Prompt assets
Indexing job
Separate knowledge-base synchronization pipeline.
- Index job entry point
zammad-ai-index/main.py - Zammad KB source
zammad-ai-index/job/zammad/api.py - Document processing · Produces vector-ready knowledge records.
zammad-ai-index/job/data/processing.py - Qdrant index writer
zammad-ai-index/job/qdrant/qdrant.py
Safety service
Independent HTTP guardrail runtime.
- Guardrails entry point
slm-guardrails/main.py - Guardrail decisions
slm-guardrails/guardrail_app/guardrails/service.py
Observability
- Langfuse tracing
zammad-ai-workflow/app/observe/langfuse.py - Prometheus metrics
zammad-ai-workflow/app/settings/prometheus.py
Other components
- Zammad
- Kafka
- Qdrant
- GenAI providers
Connections 30
- Workflow entry point → HTTP API: starts
- Workflow entry point → Ticket event consumer: starts
- HTTP API → Triage service: triage requests
- HTTP API → Answer service: answer requests
- Kafka → Ticket event consumer: ticket events
- Ticket event consumer → Triage service: dispatches
- Triage service → Content preparser: normalizes input
- Triage service → Triage GenAI handler: interprets ticket
- Triage GenAI handler → GenAI providers: model calls
- Triage service → Ticket actions: automation result
- Ticket actions → Zammad adapters: applies changes
- Zammad adapters → Zammad: REST / EAI
- Answer service → Content preparser: normalizes input
- Answer service → Knowledge retrieval: retrieves context
- Knowledge retrieval → Qdrant: vector search
- Answer service → Answer agent: generates draft
- Answer agent → GenAI providers: model calls
- Answer service → Answer judge: evaluates response
- Answer service → Guardrail client: safety checks
- Guardrail client → Guardrail decisions: HTTP
- Guardrails entry point → Guardrail decisions: starts
- Triage GenAI handler → Prompt assets: uses triage prompts
- Answer agent → Prompt assets: uses answer prompts
- Index job entry point → Zammad KB source: runs pipeline
- Zammad KB source → Zammad: fetches KB data
- Zammad KB source → Document processing: documents
- Document processing → Qdrant index writer: vector records
- Qdrant index writer → Qdrant: upserts vectors
- Workflow entry point → Langfuse tracing: traces
- Workflow entry point → Prometheus metrics: exports metrics