Skip to content

A planner and worker example verifies a fenced handoff result - #769

Merged
zlareb1 merged 3 commits into
mainfrom
example/multi-agent-handoff
Nov 17, 2026
Merged

zlareb1 merged 3 commits into
mainfrom
example/multi-agent-handoff

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Closes: #710

Changelog category (leave one):

  • Documentation (changelog entry is not required)

Changelog entry

Not required.

Why

The task reference documents each operation separately. The runnable example connects inbox registration, a fenced claim, a heartbeat, a result memory and task completion. A planner reads the worker's result and verifies its value and provenance.

The agents use separate service-account tokens in an existing namespace. The planner needs admin to register the inbox; the worker needs writer. Their authenticated subjects are checked separately from their agent names. The calculation uses Python without an agent LLM or extraction API call; memory writes follow the server's embedding configuration.

Scope and risk

One Python example, its HTTP mock tests, an authenticated CI scenario, setup and expected-output instructions in the examples README, and the multi-agent guide's Start link. The CI scenario runs the example with separate admin and writer principals in the existing authenticated ClickHouse and Postgres jobs. The result includes its task id so another task calculating the same value cannot merge it into a different key. A no-op write refuses completion. The example verifies the returned fence, task outcome, structured result, writer agent, complete actor and source class.

Cleanup cancels unfinished work with the current owner's token and deletes the result memory even if task cancellation fails. Inbox and task history remain. A failed check or API call raises an error; a network failure can prevent cleanup from reaching the server.

Compatibility, rollout and rollback

  • Wire: none. Existing SDK operations only.
  • Operator steps: register a namespace, then mint distinct planner/admin and worker/writer service-account tokens for it with the documented subjects.
  • Rollback: revert the example and documentation. Existing inbox and task history remain.

Tests

  • Ruff lint and formatting pass for the example and its test file. The dependency update preserves all four feature files byte for byte.
  • All 15 final-source HTTP mock cases pass. These use an in-process transport and do not establish real server authentication or persistence.
  • Two canonical-merge regression cases fail before the fix and pass after it. The authenticated CI scenario runs and passes against ClickHouse and Postgres 16 and 18, using separate admin and writer principals.
  • PR CI passes, including all six unit shards, combined coverage, branch-coverage floors, benchmark harnesses, authenticated integration, documentation and packaging checks.
  • The first CI attempt failed the Java numbered-sources CPU-cost check. Its extraction source and cost harness are unchanged by this PR. One retry of failed jobs passed; the cause of the first failure is unknown.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex wrote the example, tests and instructions.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full PR CI passes, including unit, benchmark and integration checks.
  • Formatting and lint checks pass; the example passes a focused type check.
  • All 15 source-matched HTTP mock cases pass.
  • Native, documentation and packaging checks pass.
  • Generated references are current; no wire or schema change.
  • Documentation states the token roles, provider configuration and retained history.
  • Public text contains no internal deployment details.
  • Commits are signed off.

Run the task lifecycle with two authenticated principals and read the result with exact writer provenance. Keep memory cleanup in finally and record the bounded authenticated run.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the example/multi-agent-handoff branch from 00f1b9c to 491ca72 Compare November 17, 2026 21:54
@zlareb1
zlareb1 merged commit c11231b into main Nov 17, 2026
79 of 80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example: a planner and a worker agent hand off a task, and the planner reads the result with its provenance

1 participant