Streaming

Starting a run and observing it are separate operations, and only kagent’s scheduler starts runs. Live A2A updates provide prompt feedback; persisted task projections provide the canonical state used to reconcile a reconnect.

Runs start from schedules

Agents are headless (owner decision 2026-10-04): no RPC sends an agent a message, opens a session or answers one. kagent 1.0’s scheduler (ScheduledRunService, pinned at v1.0.1) starts every run. platform-api writes each schedule to it as the tenant’s owner: the schedules set at CreateAgent, and the wakes the agent books with its schedule_wake tool. When a schedule comes due, kagent’s controller records an execution, opens a fresh session owned by the schedule’s creator and sends the schedule’s prompt over A2A. That prompt is the only message the run is given. Each run has its own session, so runs of one schedule may overlap, and a run is bounded by the schedule’s max_run_seconds, kagent’s execution timeout. It is 15 minutes unless CreateAgent asks for 10 s to 1 h, and a cron’s is cut to the shortest gap between its runs, so one run ends before the next starts. kagent counts it from accepting the execution, so queueing and the actor’s start-up spend it, and ends a run still going then as TIMED_OUT, reason Execution deadline elapsed, cancelling its task.

kagent has only five-field cron schedules, evaluated here in UTC, which has no daylight saving: a schedule keeps its UTC time all year, and the console shows each moment in the reader’s zone beside it. kagent skips an occurrence it cannot accept within 30 seconds of its time and waits for the next, so a controller outage does not replay the times it missed. A one-shot is a cron naming its minute, hour, day and month, at most a year out (a wake at most 30 days). Once it has fired, platform-api’s run watcher pauses it so it never comes round again.

RunScheduleNow is kagent’s TriggerScheduledRun: it starts one execution without moving the schedule’s next slot. It waits briefly for kagent to open the run’s session, so RunScheduleNowResponse.session_id can be empty when the call returns; the returned schedule says what happened. The request carries no request id, so every call is a new execution: reload the schedule before retrying an ambiguous outcome.

An execution’s state reaches the API as the schedule’s last_status and as each run in the schedule history. kagent’s PENDING (accepted, preparing its session and task) and RUNNING are both RUNNING; SUCCEEDED, FAILED and TIMED_OUT keep their names, with kagent’s failure_reason as the message: Session was deleted, Execution deadline elapsed, or A2A task and the task’s terminal state (TASK_STATE_FAILED, TASK_STATE_CANCELED or TASK_STATE_REJECTED), which the console puts in words.

Deleting a schedule stops kagent reserving its occurrences, but kagent still leases the executions it already accepted, PENDING ones included, so they run to the end. kagent keeps a deleted schedule’s executions, but its list of schedules leaves the schedule out, so the history and ListSessions stop listing it, its runs and their sessions at once.

The run watcher

kagent writes no log line or metric per execution. platform-api’s run watcher (one replica, Lease platform-api-scheduler, every 30 s) reads each tenant’s executions as its owner and logs scheduler: run started and scheduler: run finished with tenant_label, agent_label, trigger, status and duration_seconds: the lines the agent_runs and agent_run_seconds log-based metrics count and the dashboards read. It also writes each run’s session binding, which compute billing uses. kagent lists no deleted schedule, so the watcher also reads each schedule the platform deleted, by id, until none of its runs can still start or end: a run still going when its agent is deleted is still logged, bound and billed. Each tenant keeps a watermark in Firestore; a window ends a minute behind the clock, and nothing before the watcher first saw a tenant is backfilled.

StreamRunEvents observes progress. Other StreamGet* and StreamList* RPCs publish snapshots for agents, sessions, billing, brokerage and operator views. There are more streams than the original four-method API. See Services.

Mutable projections, not a lossless event journal

The pinned kagent public API exposes session/task projections. It does not expose its internal append-only journal as a platform replay API. A cursor therefore identifies a session, projection revision and offset. If the persisted projection changes, reading it again starts that revision; clients upsert stable event identities and revisions rather than append every frame as new history.

Live A2A output is provisional and cursorless. The adapter assembles artifact updates and reconciles against persisted tasks periodically and at stream termination. Canonical replacement prevents a replayed artifact from duplicating provisional text. A late preview is replaced by the canonical value even when the persisted revision has not changed. Reconnect refreshes canonical values once; replacement frames may be cursorless, with the checkpoint carrying the durable progress. A terminal status from an earlier task does not suppress attachment to the current task. An append without a known artifact baseline is withheld until canonical content is available.

This recovers the observable task projection. It does not promise every intermediate status, gap-free token history or exact replay of transient frames. Bounded reads report incompleteness explicitly; a capped result cannot be described as a complete history.

Checkpoints and client state

Checkpoints include observed_at, caught_up, the durable cursor when available and reconciliation cadence. Their freshness means a successful persisted-state read, not a producer processing watermark. A fresh observation can still report incomplete coverage.

The console only reads runs: it has no composer and keeps no draft. It separates provisional updates from canonical events and treats absent counts as unavailable. Available but incomplete counts are lower bounds. Errors and disconnects remain visible while reconnection uses the last durable cursor.

These adapter and console changes have local verification; this documentation update does not establish that the corresponding API and UI builds are deployed.

Session identity

The run watcher binds each run’s session to the tenant namespace, owner, immutable agent UID and the schedule that started it (Session.triggered_by), and compute billing attributes running time through that binding. kagent targets a schedule by the agent’s name, so deleting an agent deletes every one of its schedules first, and the name stays taken: the deleted agent’s history is kept under it, and no later agent can be given it. ListSessions lists the runs of the agent’s current schedules, newest first: a deleted schedule’s runs, and a deleted agent’s, are no longer listed.

No pauses

Nothing answers an agent during a run, so no run may wait for an answer. kagent’s ask_user tool is off through the Helm value config.runtimeDefaults.builtinTools.disableAskUser on the kagent release in iac gcp/workloads/kagent.tf. The only other pause kagent can produce is a tool approval: an MCP tool binding with requireApproval pauses before each call to its tools and parks the task in input-required until a client answers on the same task, and nothing on the server expires a parked task. No platform write path sets that flag, so the contract has no approval RPC or reply type: ApproveTool, SendMessage.hitl_reply and PendingInput were removed in api #87.

No run can pause for a person, so nothing has to cancel one that does. A run still ends at its schedule’s max_run_seconds.

The upstream human-in-the-loop documentation describes the pause and the answer the platform never sends; the pinned runtime determines the platform’s exact behavior.

Transport and timeouts

All public streams are server-streaming. Clients must inspect terminal stream errors, including errors delivered after the initial response, rather than trusting HTTP status alone. The API keeps its HTTP server write timeout disabled for long-running streams and uses request-level bounds. The GKE backend timeout is configured for long responses. A dropped connection still requires reconciliation; neither timeout settings nor a cursor make the live transport durable.