Skip to content

feat(agents): every bundled agent declares its trajectory's native format - #801

Merged
earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-6076-agents-native
Nov 19, 2026
Merged

earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-6076-agents-native

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The follow-up to Y2a (#787) for FD-6076: every bundled agent now declares its trajectory's native format. Protocol 0.1.588, which carries #787, is on PyPI, so the agents' images can take it.

What changes

  • Each bundled agent passes its existing format id to enable(TRAJECTORY_V1, native=...):

    Agent Native format
    Claude Code claude-code-stream-json/1
    Codex codex-exec-json/1
    Gemini gemini-stream-json/1
    Hermes hermes-hook-events/1
    Letta Code letta-code-events/1
    OpenCode opencode-events/1
    OpenHands openhands-events/v1
    pi pi-json-events/v1
    Pydantic AI pydantic-ai-messages/v1
    browser-use browser-use-messages/1 (now a TRAJECTORY_FORMAT constant)
    proxy agentenv-proxy/v1 (its code is the protocol's, which already declares it)

    So each card lists formats, native and default. The SDK holds each agent's log and returned native trajectory to that format, a read naming another format gets format_not_offered, and every read the SDK serves names its format.

  • pi's final read now reports pi-json-events/v1. Its returned native trajectory keeps its format at seal, which was the null-label bug.

  • Every agent's protocol floor rises from 0.1.582 to 0.1.588, the first with native, as build(agents): the bundled agents take the protocol whose extension routes take the control token #784 did for the control token. The proxy is included. Each folder changes, so each image is rebuilt at the next release.

  • The two agents that serve their own context reads now name what they serve:

    • Claude Code's context reads return the records of the CLI's session file, the conversation so far, which isn't its native stream. Decision 3 says those get an id of their own, never native. They name claude-code-session/1 (SESSION_TRAJECTORY_FORMAT).
    • Codex's context reads return its native events from the SDK's log, and name codex-exec-json/1.
  • A flaky test fixed. Codex's test_the_catalog_read_counts_against_the_turns_time_limit assumed a catalog read takes under a second, and failed under load. It now times the read and checks the CLI's budget lost at least that.

Choices to review

  • The id claude-code-session/1 for Claude Code's session-derived context reads. Y5 decides whether the card lists it. Until then a read naming no format, or naming native, still gets that shape, now labelled. Readers trust a response's format over the card (Decision 3).
  • The agents' set_format(TRAJECTORY_FORMAT) calls stay. With native declared they're no-ops, but some agent unit tests build a TrajectoryLog without native and rely on them.

Testing

  • tst/unit/agents/test_trajectory_formats.py: every bundled agent's class declares its native format, and its card params are formats, native and default. A new agent folder that isn't listed fails the test.

  • The proxy's container install test (integration) now checks the installed proxy's real card offers agentenv-proxy/v1. It also checks a cursor read naming that format names it back, and a read naming atif/1 is refused with format_not_offered. It's assertions in an existing test, so CI time doesn't change.

  • Claude Code's and Codex's context-read tests expect the named format; their image-contract tests expect the new floor. All 1,027 agent unit tests pass, and ruff check . passes.

  • e2e on an x86 test host, no model: all 11 agent images, each built from this branch with the release's own infra_build.py build ENTRY amd64, passed. Each one's real card offered its native format as formats, native and default, and each refused a read naming atif/1 with format_not_offered.

  • e2e on an arm64 test host, real model, every agent but the proxy (whose turns its caller plays; the integration test above covers it). Two rounds, both from this branch:

    • One A2A turn on each agent's image, built with infra_build.py build ENTRY arm64, with the smoke tasks' prompt (echo $((6 * 7))). Every turn completed, so no agent's returned native trajectory trips the hold at seal, and every reply said 42. After the turn, the task read, the task read naming the native format, and the context read each named that format. Claude Code's context read named claude-code-session/1. The live agents' events reads, during the turn and after, named it too. pi and browser-use aren't live, so they refuse those reads, as they should. Every agent refused atif/1 with format_not_offered. Each image installed protocol 0.1.594 from PyPI.
    • Each agent's smoke task through agent-env run agents --task <agent>-smoke --model <model>: all 10 passed. browser-use's ran on a chromium browser composed for arm64. That turn completing is what shows browser-use's native trajectory holds at seal, since its turn in the first round had no browser.
    Agent Model Turn and reads Smoke task
    Claude Code Sonnet 4.6 pass (live) pass
    Codex GPT-5 mini pass (live) pass
    Gemini Gemini 2.5 Flash pass (live) pass
    Hermes Sonnet 4.6 pass (live) pass
    Letta Code GPT-4.1 mini pass (live) pass
    OpenCode Sonnet 4.6 pass (live) pass
    OpenHands Sonnet 4.6 pass (live) pass
    pi GPT-4.1 mini pass (not live) pass
    Pydantic AI GPT-4.1 mini pass (live) pass
    browser-use Sonnet 4.6 card and refusal only, no browser pass

    The model calls cost well under $2. The images and containers were removed after, and the host stopped.

  • CI: 33 pass on d68fc5f; installer skips, as it does when a pull request touches none of its paths. The proxy integration test passed in both its containers, sh-only and with bash. Greptile: 5/5, every thread resolved.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Bundled agents now declare their native trajectory formats, and context reads name the format they return.

  • Bundled agents declare the native format their trajectory reads use.
  • Claude Code context reads name the format of their session records.
  • Codex context reads name the format of their event records.
  • The Codex catalog timing test measures how long its read takes.

The previous scheduling-allowance finding is fixed. No new issues found in the follow-up change.

Reviews (7) · Last reviewed commit: "test(agents): the catalog-read budget te..." · Reviewed by Greptile

earakely-scale and others added 3 commits November 18, 2026 18:10
…rmat

Each bundled agent passes its existing format id to enable(TRAJECTORY_V1, native=...), so its card lists formats,
native and default, the SDK holds its log and returned native trajectories to that format, and every read it serves
names it; pi's final read now reports pi-json-events/v1. Each agent's protocol floor rises to 0.1.588, the first with
native. Claude Code's own context reads, the records of the CLI's session file, name claude-code-session/1, never the
native format; Codex's own context reads, its native events, name codex-exec-json/1. browser-use gets a
TRAJECTORY_FORMAT constant. A test holds every bundled agent to its native format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f assuming it takes under a second

It asserted the CLI got more than 29 of its 30 s after a read that sleeps 0.5 s, which failed under load (28.9 s).
It now times the read in its stub and checks the CLI's budget lost at least that, within two seconds of scheduling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… format, its reads name it and refuse another

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 19, 2026 02:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit a6602c7 into main Nov 19, 2026
37 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-6076-agents-native branch November 19, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant