# Section 08 · Asynchronous work and scheduling A quality agentic system does little while the user waits, and a great deal while their back is turned. The interactive turn stays thin; heavy, costly, or deferred work is pushed to the background. This section is the runbook for that separation: what runs synchronously, what runs asynchronously, through which triggers, and under which safeguards. > Guiding rule: anything not needed for the current turn's response leaves the turn. Extraction, consolidation, synchronization, summaries, reminders: in the background. The interactive turn pays only for indispensable latency. ## Two regimes: event-driven and scheduled | Regime | Trigger | Use | | --- | --- | --- | | Event-driven | A business event is emitted (turn end, session close, reminder created) | Immediate reaction but off the turn: processing starts as soon as possible, without blocking the user. | | Scheduled | A clock (cron expression) fires at a fixed time | Periodic maintenance: decay, pruning, cleanup, trend detection. | ## Diagram, the post-turn pipeline and the scheduler > Diagram : interactive turn · minimal latency · turn completed · POST-TURN PIPELINE · detect commitments · detect follow-ups · extract facts · decide on a summary · prewarm the context · independent per-step retry · event: session closed · SESSION-CLOSE PIPELINE · session archiving · graph ingestion · session facts · logging · independent operations in parallel · SCHEDULER · crons · 04:00 daily · decay · 05:00 Sunday · link pruning · 03:00 Monday · detection · 09:00 daily · reminders · periodic · orphan cleanup · at fixed times, off the interactive turn ## 1 The post-turn pipeline After each turn, an event is emitted and an asynchronous pipeline fires. It chains independent steps: detect the commitments made, detect the follow-ups to schedule, extract the facts to memorize, decide whether a conversation summary is needed, and prewarm the deep context for the next turn. Each step is isolated: it has its own per-step retry, and the failure of one step does not fail the others. This is also where the importance of memories is computed, as a by-product of extraction, with no dedicated model call. Finally, at emission, the turn deposits its provenance fingerprint: a request ID and the signature of what was actually injected into the context. It is what makes it possible to replay exactly what the model saw, even after working memory has forgotten (cf. section 07). And this same trace feeds behavioral evaluation: a single stream emitted by the middleware, multiple consumers, provenance, evaluation (section 12), and observability. ## 2 The session-close pipeline At the close of a session, a second pipeline archives the session, extracts and structures its content into the knowledge graph, derives the durable facts from it, and logs the activity. Independent operations are launched in parallel, then recombined. ## 3 The periodic scheduler System maintenance is entrusted to tasks scheduled by cron expression. Sample cadences, readable directly in the configuration: | Task | Cadence (cron) | Role | | --- | --- | --- | | Memory decay | 0 4 * * * (daily, 04:00) | Updates the value score of memories; gates retrieval, does not delete. | | Link pruning | 0 5 * * 0 (weekly, Sunday 05:00) | Prunes only invalidated and old derived links, under retention. | | Cold archiving | 0 2 * * 0 (weekly, Sunday 02:00) | Compacts and cools old journal segments, kept for audit. | | Trend detection | 0 3 * * 1 (weekly, Monday 03:00) | Spots recurring patterns to capitalize on. | | Expiration reminders | 0 9 * * * (daily, 09:00) | Emits the reminders that have come due. | | Imposed erasure | On demand | Renders a subject's data unreadable (legal erasure) without breaking the audit chain. | ## 4 Safeguards for asynchronous work Poorly guarded background work is worse than no background work. Four safeguards are systematic: - Per-step retry: each step replays independently, with a bounded number of attempts, without replaying what has succeeded. - Idempotency: a replayed task produces no duplicate; the effect is the same whether it runs once or three times. It is what protects consistency when a task is delivered or replayed several times, including under concurrency. The question of ordering, a distinct one, belongs to causality (section 07), not to idempotency. - Bounded concurrency: the number of simultaneous tasks is capped, and often partitioned per user, to keep one actor from saturating the queue. - Job observability: every execution is traced; queue lag and failure rate are first-rank metrics. ## Runbook, synchronous or asynchronous | Operation | Where | | --- | --- | | Produce the turn's response | Synchronous | | Memory retrieval at the level required to respond | Synchronous, tiered | | Fact extraction, consolidation, graph ingestion | Asynchronous, post-turn | | Session archiving and summary | Asynchronous, session close | | Decay, pruning, cleanup, trends | Asynchronous, scheduled | | Prewarming the next turn's context | Asynchronous, post-turn | **Key takeaways** - The interactive turn stays thin; heavy work moves to the background, by event or by cron. - The post-turn pipeline chains steps with independent per-step retry; session close archives and consolidates. - The turn deposits a provenance fingerprint; this same trace, emitted once by the middleware, serves provenance, evaluation, and observability. - Periodic maintenance updates scores, invalidates, cools to cold storage, and prunes only derived data; it does not destroy the truth. - Four non-negotiable safeguards: per-step retries, idempotency, bounded concurrency, job observability. --- © Thibault Souris, 2026 · Creative Commons BY-ND 4.0 (https://creativecommons.org/licenses/by-nd/4.0/) · the work’s text unaltered, as plain text for this page; the PDF version is the reference: https://runward.dev/docs/en/reference/doctrine/Designing-and-Running-Agentic-Systems-2026.pdf