Golem Schedule Future Call Moonbit
Agent Buildinggolem-schedule-future-call-moonbitGolem Schedule Future Call Moonbit is an Agent Skill for agent building published in the golemcloud/golem repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Scheduling a future agent invocation from within MoonBit agent code. Use when the user asks to schedule, delay, or set a timer for calling another agent at a future time.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/golemcloud/golem/blob/HEAD/golem-skills/skills/moonbit/golem-schedule-future-call-moonbit/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/golem-schedule-future-call-moonbit, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Scheduling a Future Agent Invocation (MoonBit)
Overview
A scheduled invocation enqueues a method call on the target agent to be executed at a specific future time. The call returns immediately; the target agent processes it when the scheduled time arrives.
This is for agent-to-agent scheduled calls from code. To schedule an invocation from the CLI, see the golem-schedule-agent-moonbit skill instead.
Usage
Every method on the generated AgentClient has a corresponding schedule_ variant. Use AgentClient::scoped to obtain a client and call the schedule method with a scheduled_at datetime and the method arguments:
AgentClient::scoped("param", fn(client) raise @common.AgentError {
client.schedule_increment(scheduled_at)
})
Full Example
AgentClient::scoped("my-counter", fn(client) raise @common.AgentError {
// Schedule increment to run 60 seconds from now
let now = @wallClock.now()
let scheduled_at = @wallClock.Datetime::{
seconds: now.seconds + 60,
nanoseconds: 0,
}
client.schedule_increment(scheduled_at)
})
Schedule with arguments
ReportAgentClient::scoped("daily", fn(client) raise @common.AgentError {
let scheduled_at = @wallClock.Datetime::{
seconds: tomorrow_midnight,
nanoseconds: 0,
}
client.schedule_generate_report(scheduled_at, "summary")
})
Datetime Type
The scheduled_at parameter is a @wallClock.Datetime value representing a point in time as seconds + nanoseconds since the Unix epoch:
let scheduled_at = @wallClock.Datetime::{
seconds: 1700000000, // Unix timestamp in seconds
nanoseconds: 0, // Sub-second precision
}
Cancelable Variant
Every method also has a schedule_cancelable_ variant that returns a CancellationToken. Call .cancel() on the token to prevent the scheduled invocation from firing:
AgentClient::scoped("my-counter", fn(client) raise @common.AgentError {
let now = @wallClock.now()
let scheduled_at = @wallClock.Datetime::{
seconds: now.seconds + 60,
nanoseconds: 0,
}
let token = client.schedule_cancelable_increment(scheduled_at)
// Later, to cancel: token.cancel()
// If not cancelling, release with: token.drop()
})
Use Cases
- Periodic tasks: Schedule the next run at the end of each invocation
- Delayed processing: Process an order after a cooling-off period
- Reminders and notifications: Send a reminder at a specific time
- Retry with backoff: Schedule a retry after a delay on failure