Ch 3 — Communication & Protocols

Speech acts, ACLs, ontologies, protocols, and LLM-safe message design
Foundations
edit_note
Intent
arrow_forward
code
Encode
arrow_forward
send
Send
arrow_forward
translate
Decode
arrow_forward
balance
Align
arrow_forward
task_alt
Commit
-
Click play or press Space to begin...
Step- / 8
forum
Why Communication Is Hard
Semantics, timing, and failure
The Design Problem
In distributed AI, communication is not “dump JSON and hope.” Agents must agree on what words mean (ontology), what counts as a promise (speech acts), and how conversations terminate (protocols). Natural language is flexible but ambiguous; rigid APIs are precise but brittle. Multi-agent failures often look like planning bugs but are really misaligned message semantics — two agents “agreed” in chat without sharing ground truth. This chapter frames classical ideas that still apply when LLMs are the medium.
Pattern
Sender meaning ≠ receiver parse Protocol = who speaks when // Without all three: chaos
Key insight: Treat messages as contracts with types — even if the surface form is natural language.
swap_horiz
Message Passing vs Shared State
Two coordination substrates
Patterns
Message passing sends copies of information; agents are loosely coupled and failures are often localized. Shared memory / blackboards offer fast reads but need locks, schemas, and conflict rules. Hybrid systems pass events while persisting canonical records (e.g., ticket IDs, versioned documents). LLM stacks frequently fake shared state by stuffing everything into one context window — that does not scale and erases provenance. Prefer explicit handles (URLs, record IDs) in messages over giant blobs.
Pattern
Pass: envelope + payload Share: schema + ACL // Log both for audit
Key insight: If two agents edit the same blob without rules, you get last-writer-wins surprises.
record_voice_over
Speech Acts
Beyond literal strings
Inform, Request, Commit
Following work in the philosophy of language (Austin, Searle) and agent communication languages, treat utterances as actions: inform (assert a fact), request (ask another to act), commit (obligate future behavior). Agents reason about felicity conditions — is the speaker authorized to commit? Is the proposition grounded? LLM outputs often sound like commitments; engineering requires binding commits to tool calls, tickets, or signed tokens.
Pattern
INFORM(proposition) REQUEST(action, deadline) COMMIT(task_id, owner) // Map to your IAM layer
Key insight: Distinguish cheap opinions in chat from hard commitments in systems of record.
gavel
ACLs & Performatives
Structured illocutionary force
FIPA-style view
Historically, agent communication languages (e.g., FIPA ACL) paired a communicative act (performatives like request, inform, cfp) with a content expression in a content language. Implementations today may use JSON or protobuf with an explicit illocution field. The lesson: receivers should branch on act type, not only parse payload keys. That enables policy hooks (“reject unsigned commit”) and testable state machines.
Pattern
{ "act": "request", "sender": "A", "receiver": "B", "content": { ... } } // Keep acts enumerable
Key insight: Finite performative sets are easier to authorize, log, and fuzz-test than open-ended prose.
category
Ontologies & Content Languages
Shared vocabulary
Grounding symbols
An ontology fixes the meaning of predicates and objects (Order, Shipped, RefundEligible). Without it, two agents may use the same word for different concepts. Content languages (logic-based or JSON-schema-based) make messages machine-checkable. For LLM agents, pair natural language with a canonical schema the model must fill: slots, enums, units. Validate with parsers; never trust free-form alone for money-moving actions.
Pattern
ontology.yaml + JSON Schema validate(payload) // Reject semantic drift early
Key insight: Your ontology is a regression surface — version it like code.
timeline
Protocols as State Machines
Turns, phases, termination
Conversations with rules
A protocol specifies legal message sequences: who may speak, retries, timeouts, and terminal states. Auction phases, two-phase commit, and HTTP all follow this pattern. For LLM multi-agent chats, add max rounds, summarization checkpoints, and explicit DONE or ESCALATE transitions. Without termination rules, systems oscillate or burn tokens forever. Draw the protocol; then implement guards in code, not only in prompts.
Pattern
states + events + guards max_turns, timeout // Test unhappy paths
Key insight: If you cannot draw the state machine, you do not yet have a protocol.
smart_toy
LLMs as the Wire Format
Flexibility vs guarantees
Risks
Using raw natural language as the only interchange is seductive and dangerous. Models hallucinate structure, drop constraints, and reinterpret performatives. Mitigations: structured outputs, tool schemas, automatic validation, repair loops (reject → rewrite), and keeping prose as a human-facing view over canonical records. Monitor parse failure rates and semantic disagreements as first-class metrics.
Pattern
NL ⇄ schema (round-trip) repair on validation fail // Log mismatch examples
Key insight: Natural language is great for humans; pair it with machine-verifiable cores for agents.
checklist
Design Checklist
From theory to your repo
Shippable protocols
Inventory your acts, schemas, and protocols. For each agent pair, document initiator/responder, SLAs, and failure branches. Next chapter: once messages work, how do agents coordinate tasks without tripping over each other?
Pattern
Acts + schemas + FSM + logs golden transcripts in CI // Ch 4: coordination
Key insight: Treat conversation transcripts as test artifacts you replay after changes.