Agents Don't Need to Think Continuously: How Research Continues on Schedule After a Conversation Ends
“Check my holdings every Wednesday evening, and notify me only if something important has changed.”
An agent in a chat can easily say “Okay.” The harder question comes later: when the browser is closed, the server restarts and the next date arrives, who remembers the commitment, who is allowed to begin research, and what prevents duplicate reports?
We initially only handled the user's current request. ETF Agent later added research tasks independent of the chat connection: a user confirms a schedule once; background coordination creates a bounded research opportunity at an agreed time; reports enter independent history; and notification failure does not rerun the model.
We did not turn the model loop into a process that runs forever or repeatedly use cron to imitate a user sending a new message. What persists is the user-confirmed task definition, not an immortal agent process. Each due time offers one candidate execution opportunity, and the existing authorization and resource rules still decide whether research may begin.
1. Why Calling an Agent on a Timer Is Not Scheduled Research
One could call a chat endpoint each week with the same prompt. That creates requests, but leaves critical questions unanswered:
- Which revision of the task did the user confirm? If data scope changes, does it take effect immediately or require new confirmation?
- If two Workers see the same due time, can the system create only one Task?
- If last week's research is still running, does this week's occurrence run concurrently, catch up or skip?
- If a report was committed but notification failed, should retry repeat research or only redeliver notice?
- When the user pauses a schedule, is the next due time suppressed, or is an already running Task cancelled?
These are long-lived identity, authorization, state and resource questions—not problems of prompt interpretation. A model can help understand what the user wants reviewed each week. Saying “understood” cannot grant indefinite background execution authority.
Mature workflow systems emphasize durable time and execution state, as in Temporal's Schedule and Workflow concepts. We borrowed the separation of time triggers, durable execution and business effects. We are not claiming to use Temporal or to have recreated a universal workflow platform.
2. Convert a Natural-Language Agreement into a Confirmable Definition
We separated the process into agent proposal and user confirmation.
A proposal may fill in trigger times, time zone, research instructions, source scope, delivery location and resource limits. Future unattended execution is permitted only after a user confirms an effective, versioned definition through an authenticated entry point.
A teaching example, not literal production API JSON:
| Property | Confirmed agreement |
|---|---|
| Trigger | Wednesdays at 20:00 in a specified IANA time zone |
| Research | Check authorized portfolio snapshots and fund sources; create a review for that period |
| Limits | Bounded model requests, tool attempts, deadline and shared capacity per run |
| Delivery | Report stored in independent Task History; app notice points to the committed result |
| Effective version | Only the revision currently confirmed by the user may create future Tasks |
This also helps when editing a schedule. Adjusting descriptive wording should not rewrite all previous history. Changing sources, triggering conditions, permissions or execution limits requires renewed inspection and confirmation of the effective scope. A Task already created keeps the definition revision under which it was admitted; new edits must not silently upgrade it.
We retained existing once and weekly semantics and hashes, then introduced explicitly versioned at and interval definitions. Unsupported schedule types or versions are rejected rather than guessed into the “closest” mode.
3. Calendar Occurrences Are Opportunities, Not Guaranteed Reports
Scheduling now includes more than once per week.
The current definitions cover four time types: the existing once and weekly, a designated time at, and an interval anchored to a UTC starting instant. Intervals have a minimum supported resolution and explicit termination conditions: until cancelled, until a specified instant or after a fixed number of calendar occurrences.
An important distinction: three calendar opportunities do not guarantee three successful reports. If a slot is skipped because of downtime, overlap or an expired catch-up window, the scheduler does not extend the future indefinitely to make up a target number of successful reports.
UTC intervals follow elapsed time. Weekly plans follow civil clock time in the chosen time zone. A nonexistent local time during daylight-saving transition is skipped; a repeated civil time fires once according to the established rule. Treating either schedule as “delay a little after the last run finished” introduces drift and changes what the user confirmed.
When two instances discover the same slot, stable occurrence identity and database admission determine the winner. Each process does not independently launch research. After multiple missed slots, only the latest eligible occurrence within the grace window is considered; the system does not create a catch-up storm.
4. Conditional Monitoring Is Not Asking the Model to Guess Every Minute
A user may also ask: “Run new research when this indicator first crosses a threshold.” That means observing external facts and deciding whether they warrant a Task.
We did not choose to call a model on each quote read to ask if the condition holds. The implementation describes conditions using versioned read-only sources, unit-aware numeric comparisons and bounded compound predicates. Code evaluates the comparison; the model analyzes only after research has separately been admitted.
For example:
For a specified instrument, currency and price unit, request one research Task when a freshness-checked observation is at most 5,000.
Why retain instrument, unit, currency, asOf and observation identity? Because a stale quote, a number in another currency or a timed-out source is not proof that the threshold condition is false.
Condition evaluation is therefore three-valued:
| Observation | Meaning | May it trigger research? |
|---|---|---|
| true | Fresh, comparable observation satisfies the predicate | Still subject to Task admission |
| false | Valid comparable observation explicitly fails the predicate | No; may become a baseline for a later true edge |
| unknown | Stale, failed or noncomparable source, or other unresolved evidence | No; must not fabricate a true-to-false transition |
There are two distinct trigger modes.
firstMatch latches only after the condition matches and the underlying Task is actually created. If a valid match is denied due to scope or capacity, do not record an imaginary successful trigger. Once creation succeeds, a failed research run or a notification retry must not automatically trigger it again.
everyEdge observes the first match and an explicit false → true transition, subject to cooldown, overlap and budget rules. An edge suppressed during cooldown is recorded as suppressed, not secretly queued for later. Staying true does not rerun research at every polling interval. An unknown observation cannot re-arm the edge.
The conditional path was validated with synthetic mockQuote observations, real PostgreSQL, and normal application assembly. Live market providers still require integration and operating qualification.
5. Six Facts from Trigger to Report Must Remain Separate
We reused authoritative records for Schedule, Task, Run, Control, Publication, History and Notice. We did not add a second scheduler database or a new “always-online Agent Runtime.”
Read the relationships in groups; the complete diagram remains available below.
- → Agent proposal
- → Authenticated user review
- → Confirmed schedule revision
- → Calendar slot or observation
- → Trigger decision
- → Suppressed, denied or unknown
- → Task admission
- → Finite research Run
- → Committed Publication
- → Failed or partial Task
- → Independent Task History
- → App Notice
- → Independent Task History
Complete relationship diagram · enlarge for detail
Trigger decision does not imply an automatic path to Task admission. Definition revision, permissions, resource budget, cooldown and overlap must all pass; other outcomes are recorded without launching the model. If research later fails, its Task identity and legitimate outcomes remain, rather than retroactively deleting the trigger fact.
The six facts are:
- Definition confirmed.
- Due time or condition observed.
- Task admitted.
- Run actually executed.
- Report committed.
- Notification delivered.
Each belongs to its existing owner.
A Task may create a subsequent Root Run under explicit durable continuation intent, but all Roots stay within the same Task deadline and total budget. A failed Run, a casual “continue” in model text, or a disconnected SSE stream does not authorize another Root.
Historical reports are not written back into the chat where the schedule was originally confirmed. Each occurrence has an independent Task History entry. Reading it later or starting a follow-up is a separate, authenticated access or conversation action.
6. Restarts and Lost COMMIT Receipts Are the Real Challenge
The hardest moment is not ordinary polling. It is when a Worker has committed an admission to the database but never received its success response. If a second Worker interprets “I did not see the receipt” as “nothing happened,” it may create a duplicate Task or invoke the model again.
We separate slow observation I/O from short database transactions. Reading the source happens outside DB locks; the result returns with the original revision, fence, lease and observation identity. The transaction then rechecks effective confirmation, authorization and limits, and commits the observation receipt, condition state and original Task/Control intent together.
If the database actually committed but a test wrapper dropped the post-commit ACK, recovery must use the original durable receipt; it cannot retry under a new identity. After a definition is cancelled or reconfirmed, late observations cannot cross the old fence to alter the new revision.
Observation polling has its own budget. A poll consumes a real read opportunity even if it returns unknown; “no quote returned” does not refund the read. That polling cost must not be confused with model research spending. Raising future schedule limits does not automatically replenish the current accounting period.
Final notification has a separate outbox, delivery identity and retry rule. A failed notice can be retried with the already committed report reference. It must never use a delivery retry as an excuse to rerun research.
Start with one independently executed Run
To understand who continues the original work after its submitting process exits, you do not need to deploy a complete scheduling system. The fixed Open ETF Agent v0.9 implementation extracts just this layer: admit a Run with an explicit identity, then let another process acquire its original Session execution lease and enter the same Runtime. The calendars, conditional triggers, Task History and notices described above remain capabilities of the full ETF Agent system; this small public slice does not include them.
With Node 26 in the range declared by the README, use a new directory to run this synthetic example. The stable main README checked for this update provides the usage entry point.
git clone https://github.com/hpoenixf/open-etf-agent.git
cd open-etf-agent
git switch --detach dad9c6e64f32c3d7579aea96613776b40917ec6d
npm ci --ignore-scripts --no-audit --no-fund
npm run build
node dist/src/session-cli.mjs submit --session runs/worker-example --run original-example --case durable-publication
node dist/src/session-cli.mjs work --session runs/worker-example --run original-example
node dist/src/session-cli.mjs publication --session runs/worker-example --run original-examplesubmit persists the request, bindings, limits and deadline, then exits without calling a model or tool. work is another process: it reads two synthetic documents, saves a report and commits answer text. The last command only reads the original body and receipt; it does not repeat research. Model actions come from a script, while SQLite commits, files and process handoffs really execute. The fixture's original 30-second deadline begins at submission; restarting that clock when the execution process begins would change the task itself.
Stop reasons are easy to confuse. A Worker receiving SIGTERM does not mean the user cancelled research. A sealed action can be left for the next process. But if a model request was dispatched and its result was never durably recorded, recovery does not guess that it probably failed and send it again. Follow the thin Worker entry into the original Runtime, or inspect the actual process-interruption cases. This preserves original identity and observed effects; it is not an automatic retry button for uncertain requests.
Execute the original Run after submission exits
The Worker CLI case at this fixed public snapshot separates durable submission from execution into different processes and checks that they still refer to the original work.
After installing dependencies according to the README at the linked fixed snapshot, run:
node --test --test-concurrency=1 --test-name-pattern='^9\.1 submit exits before a separate work process drives and reads the original Run$' test/worker-cli.test.mjsAfter submit, the Run is ready, has no owner, and has consumed no model or tool usage. A separate work process completes that same Run with Publication revision 1. Repeating work reads the terminal state without increasing usage or creating another body revision.
This test sets no calendar trigger, creates no Task queue, and does not validate notifications or concurrent Workers. Its scope is independent execution, original identity, and terminal readback.
One Step Further: One Confirmation Links to One Original Run
The Worker answers who continues execution, but not which Run a particular time opportunity is allowed to create. The fixed v0.18 source used for provider-free validation adds that smaller step, not a full calendar product: a trusted caller confirms a UTC instant, IANA time zone and lateness window, then explicitly invokes schedule-wake.
Confirmation retains the original question, documents, tool authority and budget. When due, the original Session inserts the original Run and its occurrence link in one short transaction. Repeated wakes from two processes still resolve to the same identity. A materialized link proves durable admission, not successful research. The original Worker executes; Publication and Reader deliver the committed body and report.
Failures remain specific: an early wake creates no Run; an expired window records a missed opportunity rather than a replacement task. A lost confirmation acknowledgment is reconciled by its original identity, without renewing the deadline or budget. Cancellation before materialization prevents a Run; after materialization it uses the original cancellation path, preserving spent resources and committed reports.
In a new checkout of that fixed commit, install dependencies from its README and run the cross-process delivery scenario:
node --test --test-concurrency=1 --test-name-pattern='^18 different-PID Worker completion, readonly Publication and original Reader exact bytes$' test/schedule.test.mjsThis synthetic scenario runs the original Worker in another process, then reads back the original body and report bytes without a model account. The manual surface is schedule-confirm, schedule-wake, schedule-inspect and schedule-publication in the CLI; the design at the same snapshot explains its full scope.
The slice explicitly selects a new schema5 database; it neither migrates an old database nor installs a background service. After a machine restart, a caller must invoke wake again. Recurrence, market conditions, notifications and the complete Task History described above remain outside this slice. Its synthetic loop does not substitute for full release qualification, nor promise that a sleeping machine will wake itself.
For a direct walkthrough, follow the same-version guide. In a separate directory, select and confirm a future instant:
INSTANT="$(node -e 'console.log(new Date(Date.now()+60000).toISOString())')"
node src/session-cli.mjs schedule-confirm --session runs/schedule-demo --schedule one-shot --revision 1 --instant "$INSTANT" --zone Asia/Shanghai --lateness 60000Keep the returned reference.confirmationHash. Confirmation stores identity, not a background waiter. At the selected instant, within the lateness window, replace CONFIRMATION_HASH with that value and invoke:
node src/session-cli.mjs schedule-wake --session runs/schedule-demo --schedule one-shot --hash CONFIRMATION_HASH
node src/session-cli.mjs schedule-inspect --session runs/schedule-demo --schedule one-shot --hash CONFIRMATION_HASH
node src/session-cli.mjs schedule-publication --session runs/schedule-demo --schedule one-shot --hash CONFIRMATION_HASHAn early call does not wait for you; a missed first-materialization window is not silently moved to another occurrence. Repeating schedule-wake after commitment follows the original occurrence and Run without starting another research task or refreshing its budget. Original report/Reader byte checks and same-Run terminal replay are retained in the provider-free CLI qualification receipt.
The real-model path enters through the original Schedule API. The current frozen real-task record first confirms the instant, with no dispatch during confirmation or pre-due inspection. After the actual due time, one explicit wake lets the original Worker and Admission continue the same Run, publish through Publication and cold-read the original report through a read-only Session Reader. This answers whether an authorized time opportunity connects to the original task, not whether a background service will start it on time.
The earlier real-request record remains separate. The CLI demonstration above has provider-free evidence; real API requests do not qualify it as a live-model CLI. Nor do zero-call cold reads make the whole task zero-call. These paths do not certify autonomous background wake, recurrence, financial quality or universal power-loss recovery.
The later public v0.25 once Scheduled Task host clarifies another race. Caller A materializes a Run in the original Session transaction, then stops before Worker dispatch. Caller B encounters the same due task. Finding an existing Run does not give B permission to take over its execution. The new host enters Worker only when its own transaction actually inserted the Run and returned the fresh-materialization observation. Otherwise, the original identity, reservations, and possibly unknown effects remain intact; recovery requires inspection and explicit run work through the original Worker. The concurrency regression at the same version tests this distinction: preventing duplicate materialization is not the same as authorizing a second dispatch.
This is still not an unattended scheduling service. In v0.25, run-due must be invoked explicitly and performs only a bounded sweep: no cron, resident daemon, recurrence, or automatic recovery of uncertain work. The release evidence also distinguishes Runtime completion from model-answer quality. The earlier v0.18 schedule-wake and this v0.25 run-due belong to different versioned examples; their commands must not be mixed.
7. What Was Actually Validated?
This capability is more than a Spec.
In a controlled time-scheduling run, the normal application configuration autonomously passed through three 120-second interval slots after authenticated confirmation, storing three distinct completed reports. Restart verification showed no unwanted fourth catch-up Task.
A separate synthetic conditional exercise validated one firstMatch and two everyEdge report/notice handoffs. These were different source versions and evidence windows, not one combined run.
Controlled PostgreSQL runs exercised concurrency, confirm/cancel fences, recovery after a lost commit acknowledgment, and exhaustion of polling opportunities without automatic replenishment. Long-term delivery behavior still needs observation in the actual deployment and notification paths.
The evidence supports this statement: under the tested application assembly and synthetic inputs, Schedule can start a finite Task outside a conversation, preserve its result, and respect its original identity across retries.
This engineering evidence covers scheduling foundations. User-facing deployment, live market-provider integration, and paid-model long-running reliability require their own validation. Important-change notifications, multi-period thesis revisions, and user corrections remain Weekly Review product work.
Conclusion: The Durable Thing Is an Agreement, Not a Reasoning Loop
If building this from scratch, I would ask when the user granted ongoing authorization, when stable Task identity is assigned and how uncertain effects recover before deciding which timer to use.
We did not keep the agent thinking while idle. We kept a confirmed durable agreement, allowing independent, finite, recoverable Runs to carry out each authorized research task.
This also explains why infrastructure scheduling can mature before the complete weekly-review product: one controls when and how a research opportunity may arise, while the other still has to prove that each report helps users identify meaningful changes to their investment thesis.
Further Reading and Discussion
Read the original on the author's blog · ETF Agent Engineering Library (stars welcome).