Advanced level · Module 1: Multi-Agent System Architecture · Lesson 2 of 3
Roles, Responsibilities and Contracts
Learners define each agent's role, tools, permissions and input/output contract as Pydantic models, so that agents can be developed and tested independently.
In this lesson you will
- Define agent roles and permissions
- Write typed contracts between agents
Key concepts
role cardtool set per agentinput and output contractPydantic messagesindependent testing
The lesson
Each agent gets a role card: purpose, instructions, tools, data it may access, what it returns and what it must never do. Different agents get different tools: the retrieval agent searches documents but cannot run analysis; the report agent writes but cannot search.
Agents communicate through typed contracts (Pydantic models) rather than free text: a RetrievalResult with passages and IDs, an AnalysisResult with figures and the query used, a ReportDraft with references.
Typed contracts make each agent testable in isolation and make failures easier to locate.
Step by step
- Write role cards for four capstone agents.
- Define input and output contracts as Pydantic models.
- Map tools and permissions to each agent.
- Write one isolated test per agent with the scripted model.
Practice activity
Produce role cards, contracts and a permission map for the capstone agents.
Expected result: Clear, non-overlapping roles with typed contracts and least-privilege tools.
Check your understanding
-
Why give different agents different tools?
Show answer
To apply least privilege and keep each agent focused.
-
Why use typed contracts between agents?
Show answer
They make agents independently testable and failures easier to locate.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.