Skip to content

Actions

Actions are the atomic unit of work in core/go. Named, registered, invokable, inspectable. The Action registry is the capability map.

c.Action("git.log", func(ctx core.Context, opts core.Options) core.Result {
dir := opts.String("dir")
return c.Process().RunIn(ctx, dir, "git", "log")
})

The signature is invariant across every action:

type ActionHandler func(core.Context, core.Options) core.Result
r := c.Action("git.log").Run(ctx, core.NewOptions(
core.Option{Key: "dir", Value: "/path/to/repo"},
))

Actions are enabled at registration. Disable to soft-stop without unregistering:

c.Action("dangerous.purge").Disable()
// ...later...
c.Action("dangerous.purge").Enable()
if c.Action("dangerous.purge").Enabled() { /* will fire */ }

Run() on a disabled action returns Result{OK: false} with code "action.disabled". The capability stays queryable via Exists().

MethodWhat it returns
c.Action(name).Exists()true if a handler is registered
c.Action(name).Enabled()true if it will run when invoked
c.Actions()All registered action names in registration order

For long-running work that shouldn’t block the request path:

r := c.PerformAsync("agentic.dispatch", opts)
taskID := r.Value.(string)
// ActionTaskStarted / ActionTaskProgress / ActionTaskCompleted broadcast on IPC

Progress updates a running task:

c.Progress(taskID, 0.5, "halfway done", "agentic.dispatch")

A Task is a named sequence of action steps:

c.Task("agent.completion", core.Task{
Steps: []core.Step{
{Action: "agentic.qa"},
{Action: "agentic.auto-pr"},
{Action: "agentic.verify", Input: "previous"},
{Action: "agentic.poke", Async: true},
},
})
r := c.Task("agent.completion").Run(ctx, c, opts)

Sync steps run sequentially — failure stops the chain. Async steps fire-and-forget. Input: "previous" pipes the last sync step’s output as _input on the next.

The registry IS the capability map. Auditable, testable, swappable. Permission boundaries (entitlements) and observability (broadcast events) attach at a single choke point — Action.Run — instead of being threaded through every call site.

action.go — full implementation including the panic recovery, entitlement check, and Task runner.