1. Home
  2. Journal
  3. AI Agent Orchestration in Production: Our Stack and Lessons

AI Agent Orchestration in Production: Our Stack and Lessons

AI agent orchestration at production scale: how we use rmux, Temporal, Kafka, Kubernetes, Argo CD and Langfuse, and the failures that taught us each rule.

YITEC Research··10 min read
Production lines of AI agents feeding a durable workflow engine, an event stream and a Kubernetes cluster, with observability dashboards watching every stage

AI agent orchestration is the layer that starts, coordinates, supervises and recovers many AI agents working toward one result. A single coding agent in a terminal is a tool. Dozens of agents building, testing and reviewing software around the clock is a distributed system, and it fails like one: hosts run out of memory, workers die mid-task, queues back up and dashboards lie.

This article describes the stack under YITEC's AI Software Factory, the system that shipped a government KPI platform from first commit to public production in about 27 hours. It covers what we run at each layer, why we chose it, and the specific failures that taught us each rule. None of it is exotic. The value is in the lessons.

The five layers of a production agent system

Most agent demos show one layer: the model and a prompt. A system that runs unattended needs five.

Layer Job What we run
Agent orchestration Start, supervise and coordinate agent sessions rmux, our in-house agent multiplexer
Durable execution Keep long runs alive through crashes and restarts Temporal
Messaging and data Move events, tasks and bulk data between services Apache Kafka, RabbitMQ, Apache Spark, Debezium
Platform and delivery Run and ship the software the agents build Kubernetes and OpenShift, Argo CD, Helm, HashiCorp Nomad, Keycloak
Observability and security Prove what happened and catch what went wrong Prometheus, Grafana, Loki, Sentry SDK with GlitchTip, Langfuse, gitleaks, Trivy

Inside the products we build, the agent layer itself uses LangGraph, LangChain Deep Agents, MCP tool servers and Hindsight for long-term memory. We contribute fixes upstream to both Deep Agents and Hindsight, so we read their source as well as their docs.

Agent orchestration: rmux and role-based agents

We do not run "an AI" on a project. We run a fleet of specialised agent sessions, and something has to own them.

That something is rmux, an agent multiplexer we build in-house, in the spirit of terminal-native agent supervisors such as herdr. A small host daemon keeps every agent and shell session on a machine under supervision. From there an orchestrating agent or an engineer can:

  • Spawn agents by role. A QA agent, a security reviewer and a migration specialist each start with their own instructions, tools and model profile. Roles live in the project, not in someone's head.
  • Wait on state, not on time. Every session reports working, blocked, or idle. The orchestrator waits until a reviewer is done or a test run prints a pass, instead of sleeping and hoping.
  • Read results directly. The orchestrator reads a session's transcript or terminal output and decides the next step.
  • Hibernate idle agents. An idle session can be shut down to free memory and resumed later with its conversation intact.
  • Stay model-agnostic. rmux supervises coding agents from several vendors and open models side by side. No station depends on one provider.

Lesson: count threads, not just memory. One night our factory process aborted with a Node.js watchdog assertion. The cause was not the factory. A development stack on the same host had pushed its systemd slice to the 16,000-task limit: one analytics engine used about 2,200 threads and a single JVM about 1,600. Agents, builds and test stacks now run in separate slices with their own limits.

Lesson: reserve capacity before heavy jobs. A host once went down hard while five orchestrators, about twenty sub-agents and several Maven builds ran on top of production workloads. Now every heavy job declares a resource reservation first, and the scheduler refuses work that would overcommit the box.

Durable execution with Temporal

Agent runs are long, costly and fragile. A work order in our factory passes planning, build, browser QA, review and merge, and each step can take minutes to hours. Losing that work to a reboot is not acceptable.

Every work order is a Temporal workflow. Each station is an activity with its own timeout and retry policy. Custom search attributes hold the repository and the work-order ID, so an operator can find any run in seconds. The Temporal frontend only accepts mutual TLS from our own certificate authority. In a deliberate crash test we killed the worker at step 3 of a 12-step run, and the run resumed at step 4.

Temporal removed whole classes of bugs. It also taught us four lessons the documentation does not stress.

  1. Recovered work ignores your in-memory limits. After a restart, Temporal correctly hands back every unfinished activity at once. Our worker's parallelism cap lived in memory and was exceeded immediately. We added a hard local cap in the worker itself.
  2. Never run two workers on one task queue with different databases. During a host migration the new worker started before the old one had stopped. Each held a different database, so every activity picked up by the "wrong" worker failed. Now a production line moves only after the old worker is fully stopped and its state has been copied.
  3. Masked is not disabled. We stopped an old worker with a runtime mask. The host rebooted, the mask was gone, and the old worker came back and took jobs from the new line. Retired workers are now disabled and given a different identity.
  4. Protect Temporal's own database. After repeated out-of-memory events on a host, Temporal's PostgreSQL write-ahead log was corrupt and the service would not start. Persistence now lives on a named volume on a less crowded host, and our recovery routine returns in-flight work to the queue, so a cold start is safe.

Messaging and data: Kafka, RabbitMQ and Spark

Agents and the systems they build exchange two kinds of messages, and they need different tools.

Apache Kafka RabbitMQ
Model Append-only, partitioned log Broker with queues and routing
Best for Events many consumers read; replay; audit trails Tasks one worker takes, acknowledges and finishes
Ordering Per partition Per queue, weakened by redelivery
Typical use in our work Integration events, change data capture, audit records Background jobs and storefront queues

On data-integration platforms we use Kafka as the event backbone and Debezium to stream database changes into it. Apache Spark runs the batch side: consolidation and reconciliation jobs that join records from many sources. On a commerce migration for a German software company, our team in Germany moved RabbitMQ-backed storefront queues to new infrastructure along with the rest of the stack.

Lesson: test the round trip, not the 200. A producer that returns success proves nothing about the consumer. Our acceptance suites cover the API, the UI, Kafka and file transfer, and our load tests write data and then read it back at the far end. A message that is accepted but never consumed fails the test.

Lesson: make consumers idempotent from day one. RabbitMQ redelivers unacknowledged messages and Kafka consumers re-read after a rebalance. Any handler that cannot safely run twice will eventually corrupt data. See RabbitMQ's notes on acknowledgements and confirms.

Platform and delivery: Kubernetes, OpenShift and Argo CD

The software our agents build ships to Kubernetes, often Red Hat OpenShift in government environments, through GitOps. Argo CD watches a Git repository with one application manifest per environment and network zone, and Helm charts package each service. Internally we run HashiCorp Nomad for factory services and Keycloak for single sign-on across every tool.

Lesson: with GitOps, a hand fix is a temporary fix. With automated sync and self-heal on, Argo CD reverts any manual change on the cluster to what Git says. The fix belongs in the repository. Agents that deploy follow the same rule: they open a merge request against the manifests, never kubectl edit.

Lesson: read how fast the error comes back. An OpenShift 503 that returns in about 40 milliseconds with the "Application is not available" page comes from the router, not your pod. A healthy backend behind a broken route looks exactly like a dead service from outside. Our first diagnostic step is to call the service directly, bypassing the route, to split the fault in two.

Lesson: do not clone an identity provider's database between environments. We once copied a Keycloak database from staging to production to save time. Client secrets no longer matched what the production apps held, the realm carried staging hostnames, and logins broke in ways that took hours to trace. Accounts now move with Keycloak's partial import, and environments keep separate secrets.

Lesson: roles live in the token. Our apps read permissions from the identity provider's token and sync them to the database at login. An engineer who fixes a role in the application database sees it overwritten at the next login. Change the role in Keycloak.

Lesson: give containers an init process. Long-running services that spawn child processes slowly filled with zombie processes until they stopped responding. Adding init: true so PID 1 reaps children fixed a whole family of "it just hangs after a few days" bugs.

Observability: Prometheus, Grafana, Sentry and Langfuse

We watch the platform and the models separately, because they fail differently.

For the platform we use Prometheus metrics, Grafana dashboards and Loki logs with 30-day retention, all behind single sign-on. On OpenShift, start with the monitoring stack the cluster already ships before you install a second one. For application errors we use the open-source Sentry SDK. Government work under an open-source-only rule sends those events to GlitchTip, a self-hosted, Sentry-compatible server, because self-hosted Sentry is source-available rather than open source.

For model behavior we use Langfuse: a trace for every prompt, tool call and token spent, with evaluation scores attached. On a US healthcare prior-authorization platform, Langfuse gave reviewers the reasoning trail behind each AI decision and the cost of each case. Our AI agent evaluation guide covers how those traces feed CI gates.

Lesson: a green watchdog can be checking the wrong thing. Our watchdog once reported 14 of 14 checks healthy while testers were locked out of half the screens with 403 errors. Each component answered its health check. No check logged in as a real user. Our probes now sign in with test accounts for every role and open the pages those users open.

Lesson: keep health checks out of your traces. Load-balancer pings ran every few seconds and buried real transactions in tracing data until we excluded them.

Lesson: the tool can fail silently. One error-tracking key contained characters the SDK rejected. The SDK logged "Invalid DSN" once and then sent nothing, so the dashboard looked calm because nothing arrived. Every integration now has a test event in its smoke test.

Agents inside products: LangGraph, Deep Agents and memory

When the product itself contains agents, we pick the framework by the shape of the work. LangGraph is our default for explicit, stateful flows with checkpoints and human approval. LangChain Deep Agents fits a single agent that must plan, work in a file system and delegate to sub-agents. Tools sit behind MCP servers so a framework change does not mean rewriting integrations, and long-term memory goes in a dedicated layer such as Hindsight rather than an ever-growing prompt. Our agentic AI development guide compares the options.

Lesson: generate from facts, then verify. One copilot wrote a free-text narrative and a validator checked each sentence against verified facts. It dropped almost every honest sentence, because free writing rarely matches facts word for word. The fix was to send the verified facts to the writer and have it compose only from them. Verification then passed, and the text stayed true.

Lesson: let models raise, let rules decide. In an infrastructure-monitoring product, a machine-learning layer flags anomalies, but a deterministic decision layer and an AI filter decide what becomes an alert. Models are good at noticing. They are poor at owning a page at 3 a.m.

Security gates in the pipeline

Speed without security is just risk delivered faster. Every factory line runs static code analysis, dependency checks, secret scanning with gitleaks and image scanning with Trivy before review. Findings need triage, not muting: one early scan reported 53 possible secrets, all of which turned out to be test fixtures and seed data. We baselined those with justification instead of switching the rule off. On the government KPI platform, this pipeline was followed by an independent government security audit and penetration test, which the platform passed clean.

How YITEC does it

The stack is the same across our work. What changes is how much autonomy each line gets.

  • Government KPI platform. 22 features built, tested and merged the same day; public production about 27 hours after the first commit; 4,459 commits and 77 releases seven weeks later, behind continuous security testing. Read the case study.
  • The factory itself. Durable on Temporal, crash-tested, and grown from 8 to 26 parallel production lines in 4 days on a national integration platform. See how.
  • Production agents. LangGraph and Deep Agents services with MCP tools, Langfuse traces and evaluation gates, delivered by our lab in Hanoi and, for GDPR work, by BetterScale AI in Germany.

If you are planning a system where agents do real work, talk to us. We will show you the stations, the gates and the dashboards before you sign anything.

FAQ

What is AI agent orchestration?
AI agent orchestration is the layer that starts, coordinates, supervises and recovers many AI agents working on one goal. It decides which agent gets which task, keeps state when a process dies, enforces limits on parallel work and cost, and routes results to the next step. In production it is usually a mix of an agent supervisor, a durable workflow engine and an event or task queue.
Why use Temporal for AI agents?
Agent runs are long, expensive and fail halfway: a host reboots, a model times out, a rate limit hits. Temporal records every step of a workflow, so after a crash the run resumes from the last completed step instead of starting over. In our crash test we killed a worker at step 3 of 12 and the run continued at step 4. You also get retries, timeouts and a searchable history for audits.
Should agents talk through Kafka or RabbitMQ?
Use Kafka when many consumers need the same events, you need replay, or the events are an audit record. Use RabbitMQ when each message is a task that one worker should take, acknowledge and finish, with routing and per-message retries. Many production systems use both. For long agent workflows, put a durable workflow engine such as Temporal in charge and let the queues carry data.
Which framework should we use to build an agent?
For agents inside a product, we use LangGraph when the flow needs explicit states, checkpoints and human approval, and LangChain Deep Agents when one agent must plan, use a file system and spawn sub-agents. Tools sit behind MCP servers so the framework can change without rewriting integrations. Long-term memory goes in a dedicated memory layer such as Hindsight.
How do you monitor AI agents in production?
Monitor two things separately. The platform: Prometheus metrics, Grafana dashboards, Loki logs and Sentry-compatible error tracking. The model behavior: Langfuse traces of every prompt, tool call, token cost and evaluation score. Then add a probe that logs in as a real test user and walks the same path your users take, because component health checks can stay green while users are locked out.

Sources

  1. Temporal documentation: Workflows and durable execution
  2. Apache Kafka documentation
  3. RabbitMQ: Consumer acknowledgements and publisher confirms
  4. Argo CD: Automated sync policy and self-heal
  5. LangGraph documentation
  6. Langfuse documentation: LLM observability
Your move

Bring us the problem everyone else quoted a year for.