Agent Tasks

The plan an agent is working from, as it works through it. Not a trace of what happened — a list of what it intends to do, which is what lets you see it heading somewhere wrong while there is still time to stop it.

src/components/ui/agent-tasks.tsx

About

From the component's own source, where it was written.

The plan an agent is working from, as it works through it.

Not a trace of what happened — a list of what it *intends* to do, which is the difference that makes it useful while a run is live. A trace tells you where it went wrong afterwards; a plan lets you see it heading somewhere wrong and stop it.

**Exactly one task is in progress at a time, and that is enforced here.** An agent that reports three tasks running has lost track of its own plan, and rendering all three as active hides the bug. Later ones are demoted to pending, with the first kept as the live one.

Nesting is one level deep on purpose. A plan that needs a tree is a plan the agent will not finish, and the sub-steps that matter are the ones under the task in flight.

Install

npx astralyx-ui add agent-tasks

Usage

import { AgentTasks } from '@/components/ui/agent-tasks'

<AgentTasks tasks={plan} />

Composer

Change the props and the source below follows.

Plan

2/5
  1. Read the ticket and classify it

  2. Look up the customer and their plan

    • get_customer
    • get_invoice
  3. Check the refund against policy

    Requested £340; the per-run cap is £200.

    • Read the refund policy
    • Compare against the cap
  4. Draft a reply

  5. Issue the refund

    Over the cap — a human has to approve it.

Props

No props to configure.

tsx
<AgentTasks tasks={plan} />

Examples

A plan mid-run

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

AgentTasks

The plan an agent is working from, as it works through it.

Extends Omit<ComponentProps<'div'>, 'children'>.

PropTypeDefaultDescription
tasksAgentTask[]required{ id, title, status, steps?, note? } where status is 'pending' | 'active' | 'done' | 'failed' | 'skipped'.
summary(done: number, total: number) => ReactNode—Caption. Receives done and total counts.
emptyLabelstring'No plan yet.'—
labelstring'Plan'—
statusLabelsPartial<Record<AgentTaskStatus, string>>——

Types

AgentTask

FieldTypeDescription
idstring—
titleReactNode—
statusAgentTaskStatus—
steps?{ id: string; title: ReactNode; status: AgentTaskStatus }[]Deliberately not a tree. A plan that needs deep nesting is a plan the agent will not finish.
note?ReactNode—
TypeDefinitionDescription
AgentTaskStatus
'pending' | 'active' | 'done' | 'failed' | 'skipped'
—

Behaviour

TopicDetailDescription
one active taskenforced hereAn agent reporting three tasks in progress has lost track of its plan. Later actives are demoted to pending rather than all being drawn live, which would hide the bug.