Once an agent is part of an application serving customers, a plausible answer is only part of the requirement. We also need to know what happens when processing stops midway, whether a tool has already changed something, and where a retry will begin. These are product operations questions as much as model questions.
In Harnix, an agent's execution of a chat turn is a Run. It has durable state and a record of events written as execution progresses. That gives us a connection between the answer a customer sees and the work behind it, including work interrupted by a worker failure.
The run is the stored job
A conversation can contain many exchanges. An agent execution within it is a run, with states for pending work, active execution and terminal outcomes such as success, failure or cancellation. A run can also pause for approval or additional user input. An answer that has not arrived yet therefore still has a concrete operational identity.
We store that identity in PostgreSQL. The run row is the job itself, rather than an entry added to a history table after the work is over. Its state, input and frozen agent configuration give the worker a basis for execution and give an administrator a record to inspect later.
This matters when a conversation is interrupted. A support team does not have to infer from an unfinished chat bubble whether the agent is still working. It can open the corresponding run, inspect its state and follow its trace. A failed turn remains a documented piece of work that can be investigated.
PostgreSQL holds the truth; Redis carries signals
Scheduling also rests on PostgreSQL. A worker claims a run with a lease and renews that lease while it remains active. If it stops maintaining ownership, the run can be claimed again. Attempts are bounded: recovery is not a promise to retry indefinitely until everything succeeds.
The important distinction is where authoritative state lives. Redis carries live updates and supports temporary functions such as caching and rate limiting. It is not the durable job queue for runs. A notification about work and the persisted state of that work have separate roles.
For a business, that separates two questions that often get confused: did the interface receive an update, and did the operation finish? Trouble delivering a live update does not by itself mean the run failed. When investigating an outcome, we return to the stored state and records rather than treating a message on an open connection as the only evidence.
Events are recorded as execution progresses
A run's event history describes state changes, model calls, model replies, tool calls, tool results and token usage. Those records are written during execution in short writes. We do not wait until the entire run finishes to persist a single block of trace data.
If we recorded everything at the end, a worker crash could take away the evidence needed to explain that same crash. Recording progress lets a later attempt distinguish completed work from unfinished work. It also lets an administrator see whether the agent is interacting with a model, using a tool or waiting for a person.
The console builds a step-by-step trace from these records. An administrator can inspect a model call's prompt, the result a tool returned and the tokens used. This is visibility into execution evidence. It does not imply access to every internal reason behind a model's choice.
Durability also has a retention boundary. Detailed trace content follows the organization's retention policy. After that content is removed, information such as the run's state, duration, token totals and final answer remains as described in the documentation. Auditability always has to be understood against the records still retained.
Resume without repeating tools with saved results
Consider a model reply that requests tool calls. A tool finishes and its result is stored, but the worker stops before the turn completes. On recovery, we do not ask the model to invent a new plan for that unfinished iteration.
Harnix reconstructs the iteration from its saved model reply, preserving the original tool call identities. For a call that already has a result in the event history, the agent reuses that result instead of executing the tool again. Keeping the model reply is essential: asking the model again could generate new call identities that would no longer match the saved results.
The business benefit is avoiding a repeated action where we have durable evidence that it finished. A worker restart is not a reason to perform a recorded data-changing operation again. The engineering team can also inspect attempts as parts of the same run rather than trying to join unrelated requests after the fact.
There is a precise boundary to that protection. An external system might complete an operation just before the worker dies, leaving no stored tool result. Recovery can call that tool again. Harnix does not provide an end-to-end exactly-once guarantee across arbitrary external systems. For consequential actions, we recommend business-level deduplication in the tool's own system. Reusing durable results reduces repeat risk; it does not replace that design.
The agent core and operational responsibility
We keep the agent core separate from the database and scheduler. It receives execution state and supplied dependencies, then emits what happens during execution. Transcript reconstruction is a pure function of the saved configuration, input and events. Persistence, job ownership and event recording belong to the surrounding execution layer.
“State in, next decision out” describes this architectural boundary. It does not make an external model or tool a deterministic mathematical function. The value is that continuation logic can be checked independently of worker operations, and the same history can reconstruct the context for a model call.
For an SMB with an existing application, we see this as a foundation for operational accountability: knowing what is waiting, what completed, which results were reused and where business systems still need their own duplicate protection. The Harnix documentation explains runs and traces in more detail, before you decide which parts of your product an agent should be allowed to change.



