
Stop Building AI Infrastructure. Just Structure the Handoffs.
- Mark Kendall
- 4 days ago
- 4 min read
Stop Building AI Infrastructure. Just Structure the Handoffs.
You Probably Don’t Need a Contract Engine, State Machine, or Global Messaging Platform
There is a point in almost every architecture discussion where a simple engineering principle starts turning into a platform.
Structured agent output is heading in that direction.
We start with a reasonable idea:
When one intelligent component hands work to another, make the handoff predictable.
Then suddenly we’re discussing global schema registries, messaging engines, state machines, contract services, universal envelopes, routing infrastructure, compatibility layers, and another platform that somebody has to own.
Stop.
Most teams don’t need any of that to get started.
There is a much simpler approach.
Define structured input and output as you build each capability.
That’s it.
The Boundary Is the Contract
Suppose you’re building an AI-assisted workflow:
Intent
↓
Analysis
↓
Security Review
↓
Implementation
↓
Testing
↓
Pull Request
The important architectural question isn’t:
“What enterprise messaging infrastructure should we build?”
It’s:
“What does each step need, and what does it promise to return?”
For example:
INPUT
↓
┌─────────────────┐
│ Security Review │
└─────────────────┘
↓
OUTPUT
The input might contain:
goal: Review authentication changes
files:
- src/auth/login.ts
constraints:
- Do not modify source code
And the output might be:
status: needs_review
findings:
- severity: high
description: Missing authorization check
file: src/auth/login.ts
next_action: Correct authorization validation
Congratulations.
You have a contract.
You didn’t need a contract server.
You didn’t need Kafka.
You didn’t need a state machine.
You didn’t need a schema registry.
You simply made the boundary explicit.
Apply the Same Principle Everywhere
This works across virtually every AI engineering capability.
Skill
A skill receives:
task + context + constraints
and returns:
result + evidence + status
Subagent
A specialized agent receives:
goal + relevant context + constraints
and returns:
findings + evidence + recommendation
Hook
A governance hook receives:
event + target + metadata
and returns:
allow / deny / warning + reason
Procedural Workflow
A deterministic workflow step receives:
current state + required inputs
and returns:
result + next state
Tool or MCP Capability
A tool receives:
typed request
and returns:
typed response
Different components can have different contracts.
That’s okay.
They should.
Don’t Create a Universal Mega-Contract
This is where architecture can go sideways.
It is tempting to create something like:
message:
id:
version:
source:
destination:
intent:
context:
state:
findings:
evidence:
metadata:
errors:
retry:
history:
correlation:
next_action:
payload:
...
Now every tiny skill needs to understand an enterprise messaging protocol.
We’ve solved a problem we didn’t have.
Instead:
Use the smallest contract that correctly describes the boundary.
If a hook only needs:
approved: true
reason: Policy requirements satisfied
that’s enough.
If an architecture agent needs:
status:
recommendation:
alternatives:
tradeoffs:
evidence:
use that.
The contract should serve the capability.
The capability should not serve the contract.
Structure the Boundary, Not the Reasoning
AI should still be allowed to reason.
Inside an agent:
Explore
↓
Reason
↓
Search
↓
Compare
↓
Reconsider
↓
Decide
That can remain flexible and goal-oriented.
But when the result crosses a boundary:
AI Reasoning
↓
───────────────
BOUNDARY
───────────────
↓
Structured Result
↓
Next Component
That’s where structure matters.
A useful rule is:
Agents can reason freely internally. They should communicate predictably externally.
Structured Context Is Better Context
There is another major benefit.
Imagine an analysis agent examines 40 files.
The next agent probably doesn’t need those same 40 files dumped into its context window.
Instead:
40 Files
↓
Analysis Agent
↓
Structured Handoff
├── findings
├── evidence
├── constraints
└── next_action
↓
Implementation Agent
Now we’re passing minimum sufficient context rather than blindly passing history.
That can reduce context consumption while making the next agent’s job clearer.
Structured output isn’t merely about machine readability.
It’s about context quality.
Validate What Matters
If you declare:
findings:
type: array
then:
findings: []
is valid.
But:
findings: null
isn’t valid unless the contract explicitly allows it.
That’s important.
Once we declare a contract, we should respect it.
The basic lifecycle becomes:
DECLARE
↓
EXECUTE
↓
VALIDATE
↓
EMIT
↓
HAND OFF
If validation fails:
VALIDATE
↓
INVALID
↓
REPAIR / RETRY / FAIL
Nothing exotic is required.
A JSON Schema, typed object, Pydantic model, TypeScript interface, or whatever fits the technology may be enough.
Let Common Patterns Emerge
Don’t start by deciding that every AI component in the enterprise needs these seven fields.
Build.
Observe.
Reuse.
Suppose after building twenty capabilities you discover that most outputs contain:
status:
summary:
evidence:
next_action:
Great.
Now you have evidence for a shared pattern.
Extract it.
Maybe eventually it becomes:
Standard Result
Standard Error
Standard Handoff
Maybe someday that justifies a common contract library or runtime.
But now you’re building infrastructure because repeated experience demonstrated the need.
Not because an architecture diagram looked better with another box.
The Simple AI Engineering Rule
When creating a:
Skill
Agent
Subagent
Hook
Tool
MCP capability
Procedural workflow
Agentic workflow
ask two questions:
What exactly does this thing receive?
and
What exactly does this thing return?
Define those answers.
Validate them.
Then move on.
Contracts Are a Coding Habit Before They’re a Platform
This is the important distinction.
We don’t need to begin with:
Enterprise AI Contract Platform
↓
Schema Registry
↓
Messaging Engine
↓
State Machine
↓
Governance Service
↓
Agents
Start here:
Component A
↓
Structured Output
↓
Component B
Then:
Component B
↓
Structured Output
↓
Component C
Eventually, if the architecture genuinely demands additional infrastructure, the patterns will tell us what to build.
Until then, keep it simple.
The Principle
The principle isn’t:
Every AI system needs a global contract architecture.
It’s:
Every meaningful AI boundary should have a clear input and a predictable output.
Or even simpler:
Know what you’re receiving. Know what you’re returning.
That’s not revolutionary architecture.
That’s good engineering.
AI didn’t change that.
It just made it important again.
For the Wix image, I’d make this one visually much simpler than the master architecture image: big center flow of INPUT → SKILL / AGENT / HOOK / WORKFLOW → STRUCTURED OUTPUT → NEXT STEP, with a small crossed-out cloud underneath labeled “No Global Engine Required.” That would communicate the entire article almost instantly.

Comments