liveBook · Manning

Contract

As explained in Designing AI Agents

An agreement specifying conditions that a task, state, authority, or evidence must satisfy.

A contract specifies the conditions a task, state, authority, or evidence must satisfy. In an agent workflow, program-enforced contracts protect consequential handoffs while leaving the agent free to explore and choose steps in natural language. section 10.0 section 10.4

Make a handoff explicit when a mistake could affect:

  • Shared or durable state: identify its source, version, owner, and mutation rules. section 10.4
  • Authority: bind approvals, credential use, and tool visibility to the principal and task. section 10.4
  • External effects: specify intent, preconditions, retry or idempotency behavior, and a recovery boundary. section 10.4
  • Task completion: obtain acceptance ownership and evidence from the affected world, not merely from the component proposing the result. section 10.4
Table 10.4 Consequential seam contract
Field
Purpose
Task and run identity
Prevent facts and receipts from crossing tasks
Producer and consumer
Name who creates the artifact and who is expected to act on it
Schema and semantics
Define structure and the meaning of each value
Version and provenance
Bind the artifact to its source and current revision
Owner and mutation rights
State who may revise, append, commit, or invalidate it
Principal and authority
Bind visibility and action to delegated scope
Permitted transition
Define which state change the consumer may perform
Retry, idempotency, and recovery
Prevent duplicate or unrecoverable effects
Acceptance evidence
Define what proves that the handoff or task succeeded

Use the seam contract fields as a checklist, including only those the task requires. A contract may be represented by a typed tool call, versioned file, approval receipt, test result, or another suitable artifact. section 10.4

Preserve an identifier across a handoff

A regenerated salary-template identifier passed format checks but contained the wrong value. Runtime binding instead passes the original value and its source from the producing tool receipt to the receiving tool. This enforces exact continuity without asking the model to reproduce the identifier. section 10.0

Contracts need not constrain every exploratory move. Work in a bounded, reversible workspace that cannot commit a shared result can remain flexible; forcing every search or hypothesis through a business schema would reduce adaptability. When a composed agent fails, start with the observed result and locate the first point where task, state, authority, or evidence no longer satisfies its contract. section 10.4 section 11.6

How Designing AI Agents covers it

How deep it goes
Details conditions and optional fields for consequential interfaces, then uses contract violations to locate failures.
Examples
Illustrates runtime binding with a salary-template identifier and diagnosis with a reviewer that overlooks missing relationship endpoints.
What you can do after
Diagnose/debug a composed agent by tracing the first contract violation, and specify controls for consequential handoffs.
How it connects
Connects contracts to provenance, delegated authority, idempotency, recovery, and acceptance evidence.

Also explained in

Compare how 58 books explain contract →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Agents. The section links point to the parts of the book it draws on.