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 DesignAntigravity240

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-27
Building Multi-Agent Systems with AgentKit 2.0 in Antigravity — A Production Implementation Guide
AgentKit 2.0 dropped the barrier to multi-agent systems sharply. After implementing three different agent-coordination patterns in Antigravity, here's the design playbook covering decisions, traps, and production operation.
Agents & Manager2026-04-26
Building a Subscription SaaS on Antigravity Multi-Agent — Role Splits, Quotas, and Stripe Integration That Actually Stick
Antigravity multi-agent is fun to demo. Turning it into the core of a paying subscription SaaS is a different game. Here's the implementation playbook — agent role splits, idempotent task queues, Stripe metered billing, and retention — with working TypeScript code.
Agents & Manager2026-04-23
Production Multi-Agent Systems with Antigravity AgentKit 2.0: Patterns, Failure Modes, and What the Demos Don't Show
AgentKit 2.0 makes multi-agent systems look effortless in demos, but running them in production is a different problem. This guide covers Planning vs. Fast mode, three real orchestration patterns, and the failure modes — infinite loops, cost blowouts, prompt injection — that bite on day one.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →