Skip to content

AI 301 · Module 4

Agent Communication & Message Contracts

What should agents exchange, and how do we avoid a lot of chat with poor collaboration?

Start Section 1
0 / 6 completed
Sync my progressJoin a session to keep progress across devices and share it with your instructor

Info

After you join, your completed lesson numbers are sent to your instructor together with your learner code, so they can see your progress. Use the codes your instructor gave you, and do not enter your name, company secrets or other personal data. Progress is kept with the rest of that session's data.

Learning objectives

  • Explain why agents need structured messages rather than free-form chat
  • Distinguish directed messages from broadcast messages and set communication boundaries
  • Describe the eight conceptual message types: task request, task result, status update, evidence, question, error, escalation and handoff
  • Write a message contract with sender, receiver, type, task, context, constraints, evidence, expected response, status and version
  • Explain acknowledgement, error and escalation messages and when each is used
  • Design an Agent Communication Contract between two agents

Problem and need

8 min

Lots of chat, poor collaboration

In Module 3 you designed how work is handed over. The handoff still has to travel as a message. The core question of this module is: what should agents exchange, and how do we avoid a situation with a lot of chat but poor collaboration?

Work scenario (simulated)

Two agents help a department office plan a workshop. The Scheduling agent writes: "Looks like Thursday could work?" The Venue agent answers: "Maybe, depends." Twelve messages later neither has stated which room, which date range or who decides. A person reading the log cannot tell whether anything was agreed, and cannot find the point where the misunderstanding started.

  • Free-form messages hide what is being asked and what is expected back
  • Long exchanges are not the same as progress
  • Without a shared format, a reviewer cannot audit what agents told each other
  • A message contract makes each message do one clear job

Warning

More messages do not mean better collaboration. A person should be able to read the messages between agents and tell who asked what, what evidence was given and what was decided.

Key takeaway: Good collaboration comes from clear messages with a defined purpose, not from more messages.

Core concepts

9 min

Messages, structure and communication boundaries

A message is one unit of information sent from one agent to another. Agent-to-Agent communication works best when messages are structured, meaning they have known fields, rather than paragraphs of open text.

Free-form message

  • "Can you check this and let me know?"
  • Purpose, context and expected reply are implied
  • Hard to review and easy to misread

Structured message

  • Has named fields for type, task, context and expected response
  • The receiver knows exactly what to do
  • A reviewer can follow the exchange
Directed message or broadcast (simulated)
StyleWhat it isWhen it fitsRisk
Directed messageSent to one named receiverA specific task or question for one agentThe sender must choose the right receiver
BroadcastSent to many agents at onceA notice everyone needs, such as a change in the shared goalNoise, and unclear who should act

Communication boundaries say who may message whom, about what, and with what information. An agent should not pass on information the receiver has no need to see, and it should not accept instructions from a sender that is not allowed to give them.

Check yourself

An agent needs one specific answer from one specialist agent. Which style fits best?

An agent needs one specific answer from one specialist agent. Which style fits best?

Key takeaway: Prefer structured, directed messages, use broadcast sparingly, and set boundaries on who may message whom.

10 min

Conceptual message types

Most agent-to-agent traffic can be described with a small set of message types. The names below are conceptual labels for design. They are not a standard or a wire format.

Recommended conceptual message types (simulated examples)
Message typePurposeExample
TASK_REQUESTAsk another agent to do somethingCheck the late-registration policy for Event X
TASK_RESULTReturn the outcome of a taskLate registration is allowed until Friday; see attached paragraph
STATUS_UPDATEReport progress without finishingPolicy check started; waiting for the latest rule document
EVIDENCEProvide support for a claim or resultThe rule paragraph the answer is based on
QUESTIONAsk for missing informationWhich event does this question refer to?
ERRORReport that something failed or could not be doneCannot read the rule document; access denied
ESCALATIONSend an issue to a person or higher authorityThe rule is unclear and the exception needs a decision
HANDOFFPass a task and its ownership to another agentIntake passes the task to Policy with the full handoff contract
A typical exchange
  1. TASK_REQUEST: the sender asks for a specific task
  2. Acknowledgement: the receiver confirms it has understood and accepted
  3. STATUS_UPDATE or QUESTION: the receiver reports progress or asks for what is missing
  4. EVIDENCE + TASK_RESULT: the receiver returns the result with support
  5. ERROR or ESCALATION: used instead when the task cannot be done or needs a person

Text equivalent: an exchange begins with a request and an acknowledgement. During the work the receiver may send status updates or questions. It ends with a result and its evidence. If the task cannot be done, an error or an escalation takes the place of the result.

Check yourself

A receiver cannot open the source document it was asked to check. Which message type should it send?

A receiver cannot open the source document it was asked to check. Which message type should it send?

Key takeaway: Eight conceptual types cover most exchanges: request, result, status, evidence, question, error, escalation and handoff.

10 min

The message contract

A message contract is an agreement about what fields a message carries and what each one means, so any receiver can act on it and any reviewer can audit it. It is a design agreement between agents, and it is not a technical protocol.

Message contract fields
FieldWhat it holdsExample (simulated)
SenderWho is sendingIntake agent
ReceiverWho should actPolicy agent
Message TypeOne of the conceptual typesTASK_REQUEST
Task / GoalWhat is being asked and whyConfirm whether late registration is allowed for Event X
ContextWhat the receiver needs to knowDeadline was last Friday; student asks for a one-day extension
ConstraintsWhat the receiver must not doDo not contact the student; do not promise an exception
EvidenceWhat supports the messageLink to the event rules section
Expected ResponseWhat reply is expected and in what formTASK_RESULT with a yes or no and the policy paragraph
StatusWhere the task standsOpen
Timestamp / VersionWhen, and which version, if applicableVersion 1 of the request

Info

Timestamp and version matter only when they help: for example, when a message replaces an earlier one, or when a reviewer must know which information was current. Do not add fields that no one uses.
Check yourself

Why does a message contract include an Expected Response field?

Why does a message contract include an Expected Response field?

Key takeaway: A message contract names sender, receiver, type, task, context, constraints, evidence, expected response, status and version where needed.

Boundaries and pitfalls

8 min

Pitfalls and what stays out of scope

Contracts prevent several common communication problems. They also have a clear scope in this course.

Communication pitfalls and defenses (simulated)
PitfallWhat happensDefense
Vague requestThe receiver guesses what is wantedFill Task / Goal and Expected Response
Missing acknowledgementThe sender does not know the request arrivedRequire the receiver to confirm acceptance
Silent failureThe receiver fails and says nothingSend an ERROR message and then escalate if needed
Unsupported claimA result has nothing behind itRequire Evidence with results
OversharingA message includes information the receiver does not needLimit Context to what the task requires
Chatter loopsAgents keep replying without progressDefine when the exchange ends and when to escalate

Info

Scope: this module teaches conceptual design of what agents say to each other. It does not teach a protocol implementation, message formats or how messages are transported. Reliable long-running message handling and recovery belong to another course (AI 302).

Warning

Messages between agents can carry sensitive information. Share only what the receiver needs, and keep a person able to review the exchange.
Check yourself

A team is asked to design the exact byte format used to send messages between agents. What is the right response for this course?

A team is asked to design the exact byte format used to send messages between agents. What is the right response for this course?

Key takeaway: Contracts prevent vague requests, silent failures and unsupported claims. Keep the design conceptual and limit what is shared.

Practice and apply

10 min

Practice: Design an Agent Communication Contract

Activity 4 asks you to create a communication contract between two agents. First read the example, then do it for your own use case. Please do not enter real company secrets, client personal data or any unauthorized sensitive information in this exercise.

Worked example (simulated). Intake agent and Policy agent
FieldValue
Sender / ReceiverIntake agent to Policy agent
Message types usedTASK_REQUEST, STATUS_UPDATE, QUESTION, TASK_RESULT, ERROR, ESCALATION
Task / GoalConfirm whether a late registration is allowed for a named event
Context sharedEvent name, deadline, the student's question (no personal identity)
ConstraintsDo not contact the student; do not promise an exception
Evidence requiredThe policy paragraph used
Expected ResponseTASK_RESULT with yes, no or unclear, plus evidence
End of exchange / escalationEnds with the result. If unclear or an error persists, ESCALATION to a person
  1. Pick two agents
    Choose two agents from your use case that need to exchange information.
  2. Choose the message types
    List which of the eight conceptual types they will use, and who sends each.
  3. Fill the contract fields
    Write the sender, receiver, task, context, constraints, evidence, expected response and status, and add version only if it helps.
  4. Set the boundaries
    State what must not be shared, when the exchange ends, and when to send an ERROR or ESCALATION.

Info

Deliverable: the Agent Communication Contract, showing the two agents, the message types they use, the contract fields, communication boundaries and the end and escalation conditions. It becomes part of your Multi-Agent Architecture Canvas.
Check yourself

Which item belongs in the Constraints field of a message?

Which item belongs in the Constraints field of a message?

Key takeaway: Human-AI-Human: a person defines what agents may say and share, agents exchange clear structured messages, and a person can review the exchange and stays responsible.

What next?