Integrations
Cron
Run AgentField reasoners from a server-side schedule.
The cron source runs a reasoner on a control-plane schedule. No external webhook endpoint or secret is required.
Source Surface
| Surface | Value |
|---|---|
| Source name | cron |
| Kind | Loop source |
| Secret | Not required |
| Config | expression, optional timezone |
| Event type | tick |
| Idempotency | <expression>@<scheduled-minute-utc> |
| Reasoner input | Schedule metadata as event, with trigger metadata in _meta |
Agent Code
from agentfield import Agent, on_schedule
app = Agent(node_id="scheduler")
@app.reasoner()
@on_schedule("*/15 * * * *")
async def run_every_fifteen_minutes(_input, trigger=None):
return {"fired_at": trigger.received_at.isoformat() if trigger else None}
app.run()import { Agent } from '@agentfield/sdk';
const agent = new Agent({ nodeId: 'scheduler' });
// The cron source dispatches the schedule metadata as ctx.input.event.
// The TypeScript SDK has no declarative schedule binding — connect the
// `cron` source to this reasoner from the UI (or via the trigger REST API).
agent.reasoner('runEveryFifteenMinutes', async (ctx) => {
const { event } = ctx.input;
return { firedAt: event?.fired_at ?? null };
});
agent.serve();a, _ := agent.New(agent.Config{NodeID: "scheduler", Version: "1.0.0"})
// The cron schedule binding is declared in code via WithScheduleTrigger.
// The control plane runs the schedule and dispatches a synthetic "tick"
// event; the schedule metadata arrives as input["event"].
a.RegisterReasoner("run_every_fifteen_minutes", func(ctx context.Context, input map[string]any) (any, error) {
event, _ := input["event"].(map[string]any)
return map[string]any{"fired_at": event["fired_at"]}, nil
},
agent.WithScheduleTrigger("*/15 * * * *"),
)
a.Serve(context.Background())UI Config
{
"expression": "*/15 * * * *",
"timezone": "UTC"
}The dispatched input looks like:
{
"event": {
"fired_at": "2026-06-15T10:30:00Z",
"expression": "*/15 * * * *",
"timezone": "UTC"
},
"_meta": {
"source": "cron",
"event_type": "tick",
"idempotency_key": "*/15 * * * *@2026-06-15T10:30Z"
}
}Supported Cron Syntax
AgentField supports the common 5-field cron subset:
*- integers
- ranges like
9-17 - lists like
1,2,3 - steps like
*/5or9-17/2
It does not support seconds, year fields, named months, named weekdays, or strings like @hourly.
Notes
- Event type is
tick. - Timezone defaults to
UTC. - Schedule execution uses the same dispatch path as webhook sources.