Designing Token-Efficient Always-On Agents with Five Decoupled Components
Always-on agents often waste tokens on scheduled runs that produce no new information. This article presents a five-component design—inbox, timer, memory, permissions, and outbox—and shows how to encode these responsibilities as prompt-level contracts for lightweight agents that lack a code execution layer. It covers deduplication keys, conditional wakeups, version-based idempotency, least-privilege operation, output pacing, a reusable prompt skeleton, and engineering practices for measuring and reducing idle runs.
Designing Token-Efficient Always-On Agents with Five Decoupled Components: From Idle Waste to Event-Driven Wakeups
1. Problem Definition: The “Idle-Run” Token Cost of Always-On Agents
When building a Personal Agent, developers quickly encounter a counterintuitive cost structure: the largest share of token usage often comes not from high-value tasks initiated by users, but from scheduled jobs and always-on workflows that were assumed to be inexpensive.
A typical behavior pattern is that even when the data source has not changed materially, the agent still executes the full workflow on a fixed schedule—refetching data, re-comparing it, and regenerating a complete report such as “no major updates; here is an overview of current progress.” Once or twice is acceptable. But when scheduled jobs run multiple times per day and the number of agents reaches more than ten, idle runs can quickly account for over 70% of total usage.
The root cause is not that “always-on” itself is wrong. The real issue is that always-on agents lack an event-driven wakeup and deduplication mechanism. In common industry architectures, mature always-on agent frameworks usually decouple the following five responsibilities into separate components:
- Event Inbox: receives tasks and events, deduplicates them, and processes multiple messages for the same event only once.
- Timer/Scheduler: controls when the agent is woken up, whether through delayed callbacks or scheduled triggers.
- Memory: records versions of content that have already been reported, preventing the same item from being pushed repeatedly.
- Permissions: defines the range of actions allowed after wakeup, such as read-only or read-write.
- Outbox: manages output pacing, whether to reply immediately with a single message or aggregate updates into one summary.
Agent frameworks with code-level capabilities naturally include these five abstractions. But for lightweight agents that only provide prompt configuration and no code execution layer, these five components must be “translated” into a structured prompt and written into the agent’s long-term memory or system instructions. This article focuses on that approach and provides a reusable design method and prompt pattern.
2. Decoupling the Five Components: Encoding Architectural Constraints in Prompts
2.1 Event Inbox: Version Numbers as the Core Deduplication Key
The key to deduplication is defining “what counts as the same event.” Relying only on timestamps is a common mistake. The same task may be triggered multiple times at different times, so the timestamp necessarily changes, while the content may be completely identical. The correct approach is to use task ID + content version as the deduplication key:
# Deduplication rule illustration (pseudo-code)dedup_key: "{task_id}:{content_hash}"ignore_fields: ["timestamp", "retrieved_at"] # Timestamp-only changes do not count as updatesaction_on_duplicate: "skip_and_log"
When a source is inaccessible, mark it as “pending verification” and stop retrying. Repeated retries not only consume tokens but also create noise in logs that can hide changes that genuinely require attention.
2.2 Timer: Moving from Fixed Periods to Conditional Wakeups
The goal of the timer is not to “run on time” but to “run only when it should.” In engineering terms, two types of wakeups can be distinguished:
- Fixed-period wakeup: suitable for scenarios that require regular inspection, but after wakeup the agent should first perform a lightweight change check and short-circuit immediately if there is no change.
- Conditional wakeup: triggered by an upstream event, such as a data source pushing a change signal before the agent starts, eliminating idle runs at the source.
In prompt-only scenarios, conditional wakeup can be approximated by specifying a two-stage “check first, execute later” process in the prompt: the first stage performs only a low-cost existence check, and the second stage enters full processing.
2.3 Memory: Idempotency Control Based on “Reported Versions”
The memory component maintains a “reported version list.” Before generating a report, the agent first checks whether the current version is already in the list; if it exists, output is suppressed. This mechanism complements inbox deduplication: the inbox handles “do not process the same input twice,” while memory handles “do not push the same output twice.”
Importantly, memory granularity should be tied to the task body + version, not to a vague “last report time.” Otherwise, cases where “the time was updated but the content did not change, yet the report is still pushed again” will slip through.
2.4 Permissions: Minimizing the Executable Set After Wakeup
The permissions component answers an easily overlooked question: what is the agent allowed to do after it is woken up? For unattended scheduled tasks, read-only permissions should be the default, prohibiting the agent from creating new tasks, expanding data sources, or modifying configuration on its own. This constraint also addresses a related problem: excessive agent proactivity.
A common real-world case is that a user only asks to add an animation to the interface, but the agent proactively suggests “also adding multilingual support” and “adding a scheduled update.” If the user accepts each suggestion, the scope expands rapidly and eventually becomes a large, hard-to-maintain codebase. The essence of permission constraints is to return the decision of whether to expand scope to humans.
2.5 Outbox: Explicit Control of Output Pacing
The outbox manages “when to speak and how much to say.” Available strategies include:
- Immediate single message: push each change immediately, suitable for high-timeliness scenarios.
- Aggregated digest: collect updates within a fixed time window and merge them into one message, suitable for daily or morning reports.
- Silent mode: when there is no substantive change, return only a minimal marker such as “no update,” without generating summaries, analysis, or recommendations.
Silent mode is key to controlling idle-run costs. Many agents consume large amounts of tokens even when nothing has changed because they are implicitly required to “produce something to prove they are working.” Explicitly prohibiting this behavior in the prompt can directly eliminate most invalid output.
3. Prompt Implementation: Turning the Five Components into a Behavioral Contract
When translating the above design into a prompt, follow three principles: rules must be decidable, boundaries must be clear, and prohibitions must be explicit. The following prompt skeleton can be reused directly:
[Input Processing]1. For each batch of tasks, deduplicate by "task ID + content version";timestamp-only changes do not count as updates.2. If a source is inaccessible, mark it "pending verification";do not retry repeatedly.[Output Control]3. When there is no substantive change, reply only with "no update";do not generate summaries, analysis, or suggestions to prove work.4. When there is a change, output only: task body, new facts, and impact on the task.5. Do not push the same version that has already been reported.[Permission Boundaries]6. Do not expand data sources or create new tasks on your own;scope expansion must be explicitly confirmed by a human.
The value of this prompt is that it compresses the responsibilities of the five components into six executable rules, each corresponding to an observable behavioral difference. Rule 3 addresses “blank-statement action bias”—the tendency of agents to prove their workload through output volume. Rule 6 addresses “scope creep.” Together, they impose dual constraints on cost and complexity.
4. Validation and Engineering Recommendations
In an actual deployment containing multiple personal agents, the following changes were observed after applying the five-component prompt:
- Idle runs dropped from about 18 per week to 3, a reduction of about 83%.
- The share of token usage consumed by scheduled tasks dropped from 75% to 30%.
- Combined with normal task usage, total usage dropped by about 55%, making the base subscription tier sufficient.
These figures come from practical observations under a specific configuration. Different task types and wakeup frequencies will produce different results, so readers should rely on their own monitoring data.
A few engineering recommendations for implementation:
- Measure before optimizing: label each task type as “idle run” or “effective run,” calculate the idle-run ratio, and confirm where the bottleneck is.
- Keep deduplication keys stable: content hashes should exclude volatile fields such as timestamps and retrieval times.
- Make silent output auditable: even if the agent only replies “no update,” log it so that wakeup decisions can be reviewed later.
- Tighten permissions gradually: start with read-only access, then enable write access item by item when necessary, avoiding overly broad one-time authorization.
- Set aggregation windows by scenario: use immediate push for high-timeliness tasks and aggregated digests for inspection tasks; do not apply a one-size-fits-all policy.
Conclusion
The cost problem of always-on agents appears to be about token consumption, but it is fundamentally an architectural gap: missing event deduplication, missing version memory, missing permission boundaries, and missing output pacing control. Encoding the five components as a prompt is equivalent to adding a layer of “scheduling middleware” to lightweight agents at the lowest engineering cost. The benefit is not only a lower token bill but also greater behavioral predictability. The agent shifts from “performing carefully in every cycle” to “speaking only when something changes,” which is the prerequisite for sustainable always-on agent operation.
