NVDA 162.85 ▼2.01%GOOGL 295.77 ▼0.98%MSFT 523.88 ▲0.17%AMD 534.06 ▼8.75%INTC 59.66 ▼2.52%TSMC 398.73 ▼1.67%AMZN 266.66 ▼0.29%META 641.69 ▲2.90%AAPL 356.27 ▲0.39%PLTR 167.99 ▼2.09%
Markets at last close

Apps

How Dagu manages agent context, failover and recovery

·1 min read

Dagu’s Agent DAG runtime treats the conversation as persistent execution state, linking AI operating costs and recovery to the transcript. Each decision receives a rebuilt system prompt containing task statuses and collected human answers, alongside conversation history. Observation limits bound incoming results, while context management replaces older tool results with compact summaries that preserve tool-calling structure.

Model requests follow an ordered fallback chain after applicable retries. Context overflow triggers transcript compaction and another attempt with the current model before failover, when observation aging is enabled. Successful fallback choices remain active within the process, but recovery starts again with the configured primary. Action batches are validated before execution, and sibling actions cannot consume each other’s outputs from the same turn.

After each decision, Dagu saves task state, action counts, turn usage and the conversation. Human-task suspension and failed-run retries resume that saved state rather than replaying successful actions, using the workflow definition captured when the run began. Token usage is recorded per decision and aggregated for the run, with costs included when providers report them. Declared secrets are masked before requests leave for providers, but stored transcripts retain resolved values. Access to run data therefore also exposes any secrets recorded there.

Originally reported by docs.dagu.shRead the source →
Related coverage