google / google/ax

How to resume actor with internal scheduled tasks after SuspendActor (no external signal)

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2k
Forks
120
PR merge metrics
No merged PRs in 30d

Description

## Problem

Some agent frameworks (e.g., OpenClaw-style agents) support creating **scheduled/cron tasks** that need to run persistently inside the agent process. These tasks are triggered by internal timers or schedulers within the agent, not by external user input.

Currently, the Substrate actor lifecycle in AX is:

```
CreateActor → ResumeActor → [agent runs] → SuspendActor → [actor paused]
```

After `SuspendActor`, the actor is frozen — there is no mechanism for the actor to self-resume or for an internal scheduled task to fire. The actor only resumes when an external signal (a new `Exec` call from the controller) arrives.

## Use Case

Consider an agent that:
1. Receives user input and starts a conversation
2. Creates an internal scheduled task (e.g., "check stock price every 5 minutes and alert me if it drops below X")
3. The agent needs to keep running to honor that schedule

If the conversation turn completes and AX calls `SuspendActor`:
- The actor is frozen, the internal scheduler stops
- There is no external event to trigger `ResumeActor`
- The scheduled task is effectively dead

## Questions

1. **Self-resume mechanism**: Is there (or is there planned) a way for an actor to signal "I need to stay alive / resume myself" to prevent premature suspension?
2. **Background keep-alive**: Could actors opt into a keep-alive mode where they stay scheduled even without active user input, as long as they have pending internal work?
3. **Actor-initiated resume**: Is there a path for a suspended actor to proactively wake itself up (e.g., via a wake-up callback or external trigger registered at suspend time)?
4. **Event-driven resume**: Could AX support registering wake-up conditions (timer, webhook, event) that automatically trigger `ResumeActor` without requiring a new user `Exec` call?

## Impact

Without this capability, agents with long-lived background tasks (scheduling, monitoring, polling, reminders) cannot be properly supported in the current Substrate-backed execution model. The harness would need to implement its own external scheduling layer outside of AX, which defeats the purpose of having AX manage the actor lifecycle.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.