◉ANTIGRAVITY LABJP
Articles/Agents & Manager
◈ Agents & Manager/2026-06-15Advanced

Designing Schema Evolution So Sub-Agent Handoffs Never Break

Put a typed contract at the boundary where a downstream agent receives an upstream agent's output, and learn how to evolve that schema without breaking existing flows — with validation code, a migration sequence, and the production symptoms to watch for.

AI Agent5Multi-Agent12Schema DesignAntigravity421

✦ Premium Article

When you run sub-agents side by side in Antigravity 2.0, one day a downstream agent quietly goes silent.

No error. It just reports "the field I expected was empty" and stops. Trace it back and the cause is almost always the same: the upstream agent slightly changed the shape of its output while someone was improving its prompt.

As an indie developer running multi-app update work with a main/sub agent setup, I've been tripped up by this "silent downstream" more than once. This article shares how to remove that pain by design — through typed handoff contracts and disciplined schema evolution between agents.

Why something "succeeds" and still breaks

The tricky part of multi-agent systems is that each agent succeeds on its own.

The upstream succeeds in the sense that "it returned JSON." The downstream succeeds in the sense that "it received JSON." But the shapes don't mesh. Tests are green, logs look clean, and yet the deliverable comes out empty.

I call this state "silent handoff breakage." With untyped handoffs, a shape mismatch only surfaces far downstream at runtime — and usually only in production.

The key to preventing it is one thing: validate the upstream output as the downstream input contract, right at the boundary.

Pin the contract in code

First, make the shape of the deliverable that flows between agents explicit as a JSON Schema. Merely asking "please return it in this shape" inside a prompt leaves it to the model's mood. You need to reject mismatches mechanically at the boundary.

# handoff_schema.py — the contract the upstream (research agent) passes to the downstream (writing agent)
RESEARCH_HANDOFF_V1 = {
    "type": "object",
    "required": ["schema_version", "topic", "findings"],
    "properties": {
        "schema_version": {"const": 1},
        "topic": {"type": "string", "minLength": 3},
        "findings": {
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "object",
                "required": ["claim", "source_url"],
                "properties": {
                    "claim": {"type": "string", "minLength": 10},
                    "source_url": {"type": "string", "format": "uri"},
                },
                "additionalProperties": False,
            },
        },
    },
    "additionalProperties": False,
}

The point is the additionalProperties: False.

With it, the moment the upstream adds a field on its own, validation fails immediately. You gain early detection of "something extra slipped in," but in exchange the schema evolution below needs an extra step. I recommend erring on the strict side first, fully aware of that trade-off.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A concrete implementation that validates upstream output as the downstream input contract using JSON Schema
✦A version-field method for adding fields while preserving backward compatibility
✦The production symptoms of a broken handoff, plus three safeguards that stop recurrence
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◈ Agents & Manager2026-04-07
Orchestrating a Team of Specialist Agents Solo: Practical Multi-Agent Design in Antigravity
Master multi-agent development in Antigravity. Deep dive into Manager Surface architecture, specialist agent design, AGENTS.md configuration, common patterns, and production deployment strategies for enterprise-grade systems.
◈ Agents & Manager2026-11-19
Before an Agent Reads Your Issues: Splitting GitHub Actions Into a Reader Job and a Writer Job
Anyone can write an issue body. When an agent reads it inside GitHub Actions, split the workflow into a reader job with no write access and a writer job that never runs the agent, keep the body out of the shell, and check the agent's proposal with a small Python script. Working code included.
◈ Agents & Manager2026-11-14
The Agent PR I Approved Was Rewritten a Week Later: Counting Which Lines Survive 14 Days with git blame
Agent PRs often sail through review, yet the same lines get rewritten soon after merge. Here is a small script that uses git blame to count how many of a commit's added lines are still there 14 days later, the date-ordering trap that skewed my numbers, and how I decide where to look next.