Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:A5c ai Babysitter Task Definition

From Leeroopedia
Knowledge Sources
Domains Agent_Orchestration, Task_Definition
Last Updated 2026-10-23 00:00 GMT

Overview

A design pattern for defining deterministic, replayable task units in an event-sourced orchestration system.

Description

Task Definition is the principle of separating the declaration of a task from its execution. A task is defined once with a unique identifier and a builder function that produces a task description (kind, title, agent config, etc.). At runtime, the task is invoked through a context intrinsic that records an effect in an append-only journal, enabling deterministic replay.

This addresses the problem of non-determinism in agent orchestration: by recording every task invocation as a journaled effect, the same process can be replayed with the same results, enabling debugging, testing, and quality convergence loops.

Usage

Use this principle when designing agent orchestration systems where deterministic replay, parallel execution, and human approval gates are required. It is the foundational building block for multi-step agent workflows.

Theoretical Basis

The core abstraction is a DefinedTask — a frozen object pairing an identifier with a builder function:

DefinedTask = { id: string, build(args, ctx) -> TaskDef }

The TaskDef is a declarative description of an effect:

TaskDef = { kind: string, title: string, agent?: AgentConfig, ... }

At runtime, ctx.task(definedTask, args) produces an EffectRecord in the journal. On replay, the effect is resolved from the journal instead of re-executing the agent, ensuring determinism.

Key properties:

  • Referential transparency: The same task with the same args produces the same effect.
  • Composability: Tasks compose via ctx.task, ctx.parallel.all, and ctx.breakpoint.
  • Registrability: Tasks are registered in a global registry, preventing duplicate IDs.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment