Skip to content

Long-running, goal-based tasks with steering (TaskService) #692

Open

Description

@rakyll

Problem

A Task runs its goal once, and nobody can talk to it while it runs: there is no way to add guidance, answer a question, or interrupt it. The control plane also learns little from inside the sandbox; a task's state reflects its actor, not its agent's progress, and the outcome does not reach the server.

The API already anticipates more. TaskSpec has goal and sessionId, retries are counted per turn, and TaskState has IDLE, WORKING and REQUIRES_ACTION, which nothing sets yet. The roadmap lists "Task Communication and Steering Protocols" and "Sessions".

Goals

  • A task pursues its goal over many turns, for as long as it takes, and finishes when the goal is met rather than when a process exits.
  • Users, services and other tasks steer a running task: send guidance, answer its questions, and interrupt it.
  • An idle task costs no compute: it is suspended and wakes when a message arrives.
  • Any CLI agent that can continue a session works without changes.

Non-goals

  • Changing a task's spec. Tasks stay immutable; steering adds to the task's conversation.
  • Long-term memory across tasks, and task-to-task identity. Both are separate roadmap items.

TaskService

A new gRPC service, TaskService, sits beside AX. AX stays declarative CRUD over the four kinds; TaskService is the conversation with a running task. The two differ in shape (an append-only, streamed history against get/list/create/delete) and are likely to differ in authorization, so they are separate.

RPC Description
Send Send a task guidance, an answer to its question, or an interrupt. Resumes the task if it is idle and suspended.
List Read the task's conversation: what was sent to it and what it reported.
Watch Stream the conversation and the task's state changes as they happen.

A conversation entry is either sent by a user (a message, an answer, an interrupt) or reported by the task (a state change, a question, progress, the outcome).

Lifecycle

          create / message
QUEUED ────────────────────► WORKING ──── turn ends ────► IDLE ── idle timeout ──► SUSPENDED
                               ▲  │                         │                         │
                               │  └── asks a question ──► REQUIRES_ACTION             │
                               │                            │                         │
                               └──────── message / answer ──┴──── message ────────────┘

WORKING ── goal met ──► COMPLETED        WORKING ── goal abandoned or limit hit ──► FAILED

The first turn starts from the goal; each later turn starts from the messages sent since. The agent, not the process, decides when the goal is met. spec.goal gains limits on turns, total duration, and how long the task may sit idle before it is suspended.

Runner contract

The runner owns the turn loop: it hands each turn's input to the agent, and reports turns, questions and the outcome back to the control plane. The control plane keeps the conversation durably, so nothing is lost across suspend, resume, or a server restart.

Agents integrate in one of two ways. By default, the runner starts the agent once per turn and the agent continues its session, which suits CLI agents such as Claude Code. Agent frameworks that keep their own loop can instead receive messages and report events continuously.

Tasks with explicit spec.commands keep today's behavior and cannot be steered.

CLI

ax send sends a message, an answer, or an interrupt. ax attach follows a task's conversation and sends what you type. ax describe and ax studio show the conversation.

Phases

  1. Reporting. The runner reports turn state and the outcome; tasks show IDLE, REQUIRES_ACTION and COMPLETED, and a real outcome. Useful even for today's one-shot goals.
  2. Steering. TaskService, turn-based execution in the default and Claude Code runners, ax send and ax attach.
  3. Long-running. Suspend when idle, resume on message, goal limits.
  4. Streaming agents and steering from ax studio.

Open questions

  • Should tasks without a goal accept messages, making every task chat-capable?
  • How long is a conversation kept for tasks that run for weeks?
  • Should a message from one task to another identify the sender?

Activity

  1. added this to the v1.0.0 milestone on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions