Skip to content

Agent registries

The agent loop maintains three in-memory registries for lifecycle management: tasks, teams, and cron schedules.

TaskRegistry

Tracks every task created by the agent loop. Each task has a unique ID (task-N), status (created -> running -> completed/failed/stopped), description, prompt, and an append-only output and message transcript. Tasks can be assigned to a team and carry a heartbeat for stall detection.

MethodDescription
Create(prompt, description)Create a new task in created state
Get(taskID)Look up a task by ID
List()All tasks, newest first
ListByStatus(status)Filter by status
SetStatus(taskID, status)Transition to a new status
Stop(taskID)Set status to stopped
AppendOutput(taskID, text)Append to task output
AppendMessage(taskID, msg)Append to message transcript
AssignTeam(taskID, teamID)Attach a team
UpdateHeartbeat(taskID, alive)Record lane aliveness
StalledTasks(stalledAfter)Running tasks with stale heartbeats
Delete(taskID)Remove a task from the registry

The LLM manages tasks through these tools:

ToolDescription
task_createCreate a new task (prompt, description). Returns the task ID
task_getGet a task's status, timestamps, output, and assigned team by task_id
task_listList all tasks, newest first
task_stopStop a running or created task by task_id
task_completeMark a task as completed
task_append_outputAppend text to a task's output log
task_assign_teamAssign a task to a team for multi-agent coordination

TeamRegistry

Groups tasks for multi-agent coordination. Each team has a name, a list of task IDs, and a status (created -> running -> completed -> deleted).

MethodDescription
Create(name)Create a new team
Get(teamID)Look up a team by ID
List()All teams
AddTask(teamID, taskID)Assign a task to a team
SetStatus(teamID, status)Update team status
Delete(teamID)Mark as deleted

The LLM manages teams through these tools:

ToolDescription
team_createCreate a new team (name). Returns the team ID
team_getGet a team's task IDs, status, and name by team_id
team_listList all teams
team_add_taskAssign an existing task to a team
team_deleteDelete (mark as deleted) a team

CronRegistry

Schedules recurring task creation from the agent loop process. Each cron job stores a cron expression, prompt/description templates, and tracks last/next run times. Cron jobs fire automatically - the server starts a background goroutine that calls Tick() every 60 seconds and creates tasks for any due jobs.

CLI toolDescription
cron_createCreate a new cron job with expression, prompt, and description
cron_listList all cron jobs with status, last/next run times
cron_pause / cron_resumePause or resume a cron job
cron_deleteDelete a cron job

No manual polling or goroutine setup needed. Start kdeps path/to/agent/ and cron runs in the background.

See also

Released under the Apache 2.0 License.