A support agent finishes a refund, loses its connection and restarts. The application must know whether the refund already happened before attempting the action again. Meanwhile, engineers need to know how often the refund tool times out, and the agent still needs to find the relevant refund policy. These are three different database workloads. Start by writing down the state the agent must recover, the context it must retrieve and the questions operators need to ask after a run. A journal redaction workflow can define which fields may leave a workspace before an agent sends document fragments to another service. The same policy should apply when a saved task is retried.
Match the database to the job
| Job | What you store | Operation to design around | Practical starting point |
|---|---|---|---|
| Durable state | Runs, checkpoints, approvals and tool-action receipts | Read and conditionally update one run | A transactional database your team already operates |
| Retrieval | Source chunks, embeddings, permissions and versions | Return a small set of relevant, authorized matches | Vector search in your current store or a dedicated retrieval service |
| Relationships | Entities, permissions and their connections | Follow paths or explain why an entity is related | Relational tables for simple joins and a graph store for recurring traversal |
| Operations analytics | Model calls, retries, tokens, release IDs and outcomes | Aggregate across a large set of historical runs | An analytical database |
One database can handle several jobs early on. A transactional store can keep checkpoints and index a small corpus while the product is still learning how retrieval behaves. Separate workloads when measurements show competing resource needs, when a search index needs independent lifecycle controls or when analytical queries interfere with customer-facing writes.
Make every consequential action recoverable
Store a run ID, the current step, a version number and the last successful checkpoint. Keep approval state with the action it permits. Assign each external operation a stable idempotency key when the external system accepts one. A retry should recover the original key and outcome, even when a timeout obscured the response.
During evaluation, interrupt a worker after the tool has accepted an action and before the worker can store the receipt. A replacement worker should recover by querying the tool for the outcome or replaying the request with the same key. If the tool offers neither guarantee, design an explicit reconciliation step before retry. Evaluate isolation with two workers attempting to advance the same run.
Evaluate retrieval with real permissions and deletions
An embedding index improves candidate discovery. Pair it with source IDs, document version, workspace ID and access rules. Define how deletions propagate to the search index, cached results and any derived stores. Test a policy update by changing one passage and verifying that the superseded answer stops appearing.
Use a representative retrieval set with long queries, internal terminology and questions for which the right response is that no document matches. Measure relevance, p95 latency and the rate of empty authorized results. Include a cross-workspace test with similar policies in both workspaces, since high similarity can otherwise mask a permission mistake.
Keep an event history you can slice by release
Record a completion event with a run ID, service version, elapsed time, final outcome and token totals. Emit distinct tool events when a run can use several tools or retry them independently. Query the two grains separately or join on run ID with deliberate aggregation. This helps avoid counting a run once for each tool call.
RawTree’s analytical database can cover the telemetry and event history of this layout. Its native OTLP ingestion and SQL queries are useful for comparing the same tasks across harness versions or investigating a particular tool after a release. The RawTree agent harness comparison illustrates how to compare pass rates, elapsed time and token use from a shared traces table.
Decide with a small workload replay
Replay a typical run, a retry and a failure using realistic corpus sizes and traffic. Record checkpoint recovery, retrieval relevance, query latency and the monthly cost of the sample workload. For each prospective store, identify an operator and the data that would need to move if you switch later. Adopt another database when the replay reveals a concrete need and the new store meets it predictably.
Write a separate contract for each store
For workflow state, define who can advance a run, how a writer detects a competing update, and which operation confirms a step. For a retrieval index, define who can see each document and how long a permission change takes to propagate. For an analytical store, define what a row represents and how it can be associated with other records. Each contract should have an owner who can tell whether a failed test blocks production.
Consider a personal knowledge assistant that drafts a weekly summary. The state store records which notebooks the run processed and whether it created the draft. The search index finds authorized entries using their versions and page permissions. The event stream reports time spent retrieving sources and the number of times the model had to retry. The same run identifier makes these views navigable. Each store needs its own recovery process.
Decide where a deletion starts. A user can remove a journal entry from the application and still encounter it in an old embedding, cached answer or retry input. Test that entire chain in a disposable workspace. In particular, check whether an already-running agent notices that its access changed while it was preparing a response. Set the behavior deliberately if the application cannot make every deletion immediately visible.
Run the pilot against the cases that age badly
A prototype can look convincing with a fresh corpus, one user and a handful of completed runs. Test with a history of open jobs, several versions of the same source and records that should already have been deleted. Pause a job before deploying a new worker version and check whether it resumes under the expected state contract. Repeat the same test with a failed tool call and a saved approval so the worker has to decide which information is still valid.
For context retrieval, keep a small evaluation set that includes denied results. Use similar policies in separate workspaces and deliberately create one missing policy. Compare the results before and after revoking an account’s permissions. In the operational view, count denied or empty results separately from retrieval failures. That way a decline in accessible results does not appear to be a database outage.
Introduce one event schema change while the previous producer remains live. A new run event might add a retry reason and change how it records elapsed time. Query a window that contains both representations and test the handling of missing values. Operators should still be able to explain changes in the dashboard even when deployments are gradual.
Model operating costs alongside query speed
Give each option the same workload estimate. Include active tenants, event volume per run, document updates per day, retention and peak concurrent writers. Measure the queries you will run every day alongside an incident investigation that reads several weeks of events. If your current database can absorb an additional query today, test whether it remains responsive while a large index is refreshed or a group of jobs is recovering.
Include the work of running the system. Ask who receives an index lag alert, who can verify that a recently deployed producer is sending records, and who can unblock a retry that is waiting for a receipt. Put an estimate beside hours spent operating the database as well as storage and compute. Have someone who did not set up the trial repeat it using your runbook. That test exposes dependencies on the author’s access or undocumented steps.
Decide where additional infrastructure earns its place
Start with the action that is hardest to recover. Select a durable store and prove interrupted work can be recovered first. Evaluate retrieval quality and permissions against a representative document set in parallel. Compare analytical databases once you have a realistic event stream. A shared run ID and a documented export format make it easier to evolve one piece without switching the entire stack.
Close the pilot with a decision for each workload, a measured limit and the next test to run if traffic grows. Give readers a concrete reason for each database. A choice backed by an incident replay and a permission test is easier to revisit than a blanket preference for one database family.