top of page

Designing and Implementing a Multi-Agent Collaboration Framework

  • 2 hours ago
  • 10 min read





ASSIGNMENT REQUIREMENT DOCUMENT


Course: Agent-to-Agent (A2A) — Multi-Agent Systems in Python

Student Level: Undergraduate Year 3 / Postgraduate

Submission Platform: Moodle (Learning Management System)

Individual / Group: Individual Assignments

Total Assignments: 2




This document contains the full specifications for Assignment 1. Read every section carefully before you begin. You will be assessed on the quality of your implementation, the depth of your analysis, and the clarity of your written report. Both assignments build upon the concepts taught in Chapters 1–7 of this course.




Purpose


This assignment requires you to design, implement, and demonstrate a fully functional multi-agent system that leverages every core concept introduced across Chapters 1–7 of this course. You will build agents with distinct identities and roles, enable them to communicate via structured messages, route messages using capability-based routing, delegate tasks through agent chains, carry conversation context across hops, wrap everything in a standardised A2A protocol envelope, and orchestrate a complete end-to-end workflow.




Connection to Course Learning Outcomes (CLOs):

CLO

Description

How This Assignment Addresses It

CLO-1

Understand the foundational pillars of software agents

Tasks 1–2: Define and instantiate agents with identity, role, and behavior

CLO-2

Design structured inter-agent communication

Tasks 2–3: Build and use Message objects with sender, intent, and content

CLO-3

Implement capability-based routing mechanisms

Task 3: Build a Router with multiple strategies

CLO-4

Apply delegation patterns for cooperative workflows

Task 4: Implement delegation chains with logging and safeguards

CLO-5

Manage conversation context across agent chains

Task 5: Add context to messages, validate, and demonstrate context flow

CLO-6

Formalize communication using the A2A protocol envelope

Task 6: Wrap messages in a 5-field standardised envelope

CLO-7

Integrate all components into an orchestrated system

Task 7: Build a complete end-to-end pipeline with orchestration





Learning Objectives

By completing this assignment, you will be able to:


  1. Design agent classes with identity, role, and specialized behavior using Python OOP (Bloom’s: Create)

  2. Construct a structured message protocol that separates intent from content for unambiguous routing (Bloom’s: Create)

  3. Implement multiple routing strategies (first-match, all-match, priority-based) and analyze their trade-offs (Bloom’s: Analyze)

  4. Evaluate delegation patterns including multi-hop chains, conditional delegation, and circular delegation safeguards (Bloom’s: Evaluate)

  5. Synthesize an end-to-end multi-agent pipeline where context flows, messages are serializable, and the workflow is orchestrated automatically (Bloom’s: Synthesize)

  6. Justify your design decisions with reference to software engineering principles such as the Open/Closed Principle, Single Responsibility, and the Mediator Pattern (Bloom’s: Evaluate)






Task Description


Duration: 7–10 days from assignment release

Type: Individual Assignment

Difficulty Level: Medium → Advanced


You are tasked with building a domain-specific multi-agent system of your choosing (e.g., Travel Planning, E-Commerce Order Processing, Document Analysis Pipeline, Customer Support Triage). Your system must demonstrate all core A2A concepts.




Task 1: Agent Design & Specialisation (10 Marks)

Implement a base Agent class and at least 4 specialised agent subclasses.



Requirements: 


  • The base Agent must have: name (identity), a handle or receive method (behavior)

  • Each specialised agent must override handle/receive to produce role-specific output

  • Demonstrate polymorphism: loop through a mixed list of agents, call the same method, and show different outputs

  • Demonstrate stateful agents: at least one agent must maintain a history of processed tasks

  • Include the mutable class attribute pitfall: show the bug and the fix



Deliverables: Well-commented code cells, sample outputs, and a brief written explanation of your agent hierarchy.




Task 2: Structured Messages (10 Marks)

Implement a Message class with sender, intent, and content fields.



Requirements: 


  • Create at least 5 messages with distinct intents

  • Implement repr for human-readable display

  • Demonstrate intent-based dispatch: an agent that branches behavior based on msg.intent

  • Implement a ValidatedMessage subclass that enforces a known set of valid intents

  • Implement a TimestampedMessage subclass that auto-stamps creation time

  • Build an InboxAgent that stores all received messages and can display an audit trail



Deliverables: Code, outputs, and an analysis of why intent and content must be separate fields.




Task 3: Capability-Based Routing (15 Marks)

Implement routing logic that automatically dispatches messages to the correct agent based on declared capabilities.



Requirements: 


  • Add a capabilities list and can_handle(intent) method to your agent class

  • Implement three routing strategies:

  • First-match routing - All-match routing (return all capable agents)

  • Priority-based routing - Encapsulate routing in a Router class with register(), route(), and show_registry() methods

  • Handle edge cases: - Unroutable intents (graceful failure with diagnostics) - Overlapping capabilities (two agents supporting the same intent)

  • Build a capability inventory (inverted index mapping intents → agents)



Analysis: 


  • Compare the three routing strategies. When would each be appropriate?

  • What are the risks of overlapping capabilities?




Task 4: Delegation Between Agents (15 Marks)

Implement delegation — one agent actively handing work to another.



Requirements: 


  • Add a delegate(other, msg) method to your agent class

  • Build a multi-hop delegation chain with at least 3 agents (e.g., Planner → Researcher → Writer)

  • Implement a shared delegation log that records every handoff as a structured dictionary

  • Demonstrate circular delegation detection using a depth counter or TTL mechanism

  • Implement conditional delegation: an agent should handle the task itself if capable, and delegate only if not

  • Side-by-side comparison: Show the same message being delivered via routing vs. delegation



Analysis: 


  • Clearly distinguish routing from delegation in your report

  • Discuss the risks of deep delegation chains (latency, accountability, debugging)




Task 5: Conversation Context (15 Marks)

Add a context dictionary to your Message class so state flows through agent chains.



Requirements: 


  • Extend Message.__init__ with an optional context parameter (default None, converted to {} internally — explain why not context={})

  • Demonstrate context-aware behavior: an agent that changes its response based on context keys (e.g., budget, preferences)

  • Build a 3-agent context flow: show context growing at each step using dict unpacking {**old, **new} 

  • Distinguish message-level context (msg.context) from agent-level state (self.history) with a concrete example

  • Implement context validation: define REQUIRED_CONTEXT keys and refuse to process if keys are missing



Analysis: 


  • What should go into context? What should NOT? Provide at least 5 examples of each.

  • How can context bloat be managed in production?




Task 6: A2A Protocol Envelope (15 Marks)

Formalize your message format into a standardised 5-field protocol envelope.



Requirements: 


  • Implement A2AMessage with fields: sender, receiver, intent, content, context 

  • Demonstrate receiver verification: an agent checks msg.receiver == self.name and rejects misrouted messages

  • Upgrade the Router to perform double-check dispatch: verify both receiver name and capability

  • Implement JSON serialisation: to_json() and from_json() class methods

  • Prove lossless round-trip: serialize, deserialize, and compare dict 

  • Build a message factory function for consistent message creation

  • Run a serialise → store → replay workflow: serialize a 3-message workflow to JSON, then replay it



Analysis:


  • Compare your A2A envelope to HTTP and SMTP protocols (table format)

  • Why does the receiver field matter when we already have routing?




Task 7: Full System Integration & Orchestration (20 Marks)

Wire everything together into a complete, end-to-end multi-agent system.



Requirements: 


  • Build a system with at least 4 specialist agents, a Router, and an Orchestrator

  • The Orchestrator must:

    • Accept an initial message

    • Dispatch it through the Router

    • Automatically chain subsequent messages until a terminal agent returns None 

    • Include a max_hops safety parameter

  • Demonstrate context accumulation across the full pipeline

  • Export a trace log as JSON (timestamp, events, workflow metadata)

  • Run the pipeline with at least 2 different input scenarios and compare outputs

  • Include a discussion of what would change in a production deployment (async queues, service registries, LLM-backed agents)




Bonus (Optional — up to +10 Marks)


  • +3 Marks: Implement round-robin or least-loaded routing strategy

  • +3 Marks: Build a visual trace diagram (ASCII art or matplotlib) showing the message flow through your pipeline

  • +4 Marks: Integrate an LLM (e.g., GPT API) into one agent so it produces intelligent output instead of mock data





Difficulty & Scope


Level

Description

Basic (50–64%)

All agent classes, messages, and routing implemented correctly. Code runs without errors. Minimal analysis. Outputs are shown but not deeply discussed.

Proficient (65–79%)

All tasks completed with clear code structure. Context flow, delegation logging, and protocol serialisation work correctly. Analysis compares strategies and discusses trade-offs. Report is well-structured.

Advanced (80–100%)

All tasks at a high standard. Code is modular and extensible. Demonstrates edge-case handling (circular delegation, unroutable intents, missing context keys). Analysis includes production considerations (async, distributed, LLM integration). Original domain scenario chosen. Report reads like a technical design document.





Marking Rubric


Criteria

Marks

Description

Agent Design & Specialisation

10

Base class, 4+ subclasses, polymorphism, stateful agent, pitfall demo

Structured Messages

10

Message class, intent dispatch, validation, timestamps, inbox

Capability-Based Routing

15

3 strategies, Router class, edge cases, capability inventory

Delegation Between Agents

15

Multi-hop chains, delegation log, circular detection, conditional delegation

Conversation Context

15

Context flow, validation, context vs. state distinction

A2A Protocol Envelope

15

5-field envelope, serialisation, round-trip, receiver verification

Full System Integration

20

Orchestrator, end-to-end pipeline, trace log, multiple scenarios

Total

100






Formatting & Structural Requirements


Element

Requirement

Code

Jupyter Notebook (.ipynb) with clear markdown headers separating each task

Report

4–6 pages, PDF or DOCX

Font

Times New Roman or Calibri, 12pt body text, 14pt headings

Spacing

1.5 line spacing

Margins

2.54 cm (1 inch) on all sides

Heading Structure

H1 for Task titles, H2 for sub-sections, H3 for analysis questions

Page Limit

Report: 4–6 pages (excluding code). Notebook: no page limit

Citation Style

IEEE format

Required Sections in Report

(1) Introduction, (2) System Architecture Overview, (3) Per-Task Approach & Observations, (4) Design Decisions & Trade-offs, (5) Conclusion & Key Learnings

Code Quality

Well-commented, PEP 8 compliant, docstrings on all classes/methods





Permitted Resources & Academic Integrity Policy




Permitted


  • Course notebooks (Chapters 1–7) and all provided course materials

  • Python standard library documentation

  • Official Python OOP documentation

  • Stack Overflow for syntax-level clarifications only

  • Use of libraries: json, datetime, typing — no additional external libraries unless justified




Not Permitted


  • Copying code verbatim from external tutorials, GitHub, or AI-generated solutions without understanding

  • Sharing code or reports with other students

  • Using frameworks such as LangChain, AutoGen, CrewAI, or any pre-built multi-agent library (you must build from scratch)




AI Use Policy


  • AI tools (ChatGPT, GitHub Copilot, etc.) may be used for concept clarification and debugging assistance only

  • All code logic must be your own implementation 

  • Any AI-assisted content must be explicitly declared in the AI-Use Declaration (see below)

  • Undeclared AI-generated code or text will be treated as plagiarism




Declaration Statement (must be signed and included at the top of your report):


I, [Full Name], Student ID [ID], hereby declare that this submission is entirely my own work unless otherwise referenced and acknowledged. I have not engaged in plagiarism, collusion, or contract cheating. I have declared all AI tool usage below.


AI Tools Used: [List tools, e.g., “ChatGPT for debugging a TypeError” / “None”]

Signature: _________________ Date: _________________




Step-by-Step Submission Instructions on Moodle


  1. Log in to Moodle at your institution’s URL using your student credentials

  2. Navigate to “Agent-to-Agent (A2A) — Multi-Agent Systems in Python” in your course list

  3. Click on “Assignment 1: Multi-Agent Collaboration Framework” under the Assignments section

  4. Prepare your submission as a single ZIP file with the following structure:



<YourName>_A2A_Assignment1.zip│
├── notebook.ipynb          (Jupyter Notebook with all code and outputs)
├── report.pdf              (or report.docx)
└── outputs/                (optional folder)    
├── sample_outputs.txt    
└── trace_log.json



  1. File Naming Convention: Lastname_Firstname_A2A_Assignment1.zip

  2. Click “Add submission” → “Upload a file” → drag and drop your ZIP file

  3. Accepted file formats: .zip only (maximum 25 MB)

  4. Click “Save changes” — verify your file appears in the submission area

  5. IMPORTANT: Click “Submit assignment” to finalise. A draft is NOT a submission.

  6. You will receive a confirmation email from Moodle. Save this as proof of submission.


Deadline: Submit within 10 days from assignment release date.




Late Submission Policy


Late By

Penalty

Up to 24 hours

10% deduction

24–48 hours

20% deduction

Beyond 48 hours

Not accepted




Support & Communication Guidelines


Channel

Details

Office Hours

Tuesdays & Thursdays, 2:00 PM – 4:00 PM (Instructor’s office or Zoom link posted on Moodle)

Forum (Preferred)

Post all general questions to the “Assignment 1 Discussion Forum” on Moodle. Responses within 24 hours on weekdays.

Email

For personal/confidential queries only. Use your institutional email. Include [A2A-A1] in the subject line. Response within 48 hours.

Response Times

Forum: 24 hours (weekdays). Email: 48 hours. No responses on weekends/holidays.

Peer Collaboration

You may discuss concepts and approaches with classmates. You must NOT share code, notebooks, or report text. All coding must be done independently.

Technical Issues

If Moodle is down during submission, email your ZIP file before the deadline with subject “[A2A-A1] Emergency Submission” as backup proof.





Frequently Asked Questions (FAQ)




Q1: Can I choose my own domain scenario (e.g., E-Commerce instead of Travel Planning)?

A: Yes, absolutely. You are encouraged to choose your own domain. The key requirement is that your system demonstrates all course concepts (agents, messages, routing, delegation, context, protocol, orchestration). Ensure your domain has at least 4 distinct agent roles.




Q2: Do I need to use external libraries like sentence-transformers or openai?

A: No. This assignment must be built using only the Python standard library (json, datetime, typing). The focus is on building the A2A infrastructure from scratch, not on AI/ML integration.




Q3: How detailed should my delegation log be?

A: Each log entry should capture at minimum: from (delegating agent), to (receiving agent), intent, and content. Timestamps and step numbers are optional but demonstrate advanced understanding.




Q4: What does “polymorphism in action” mean for Task 1?

A: Create a list containing instances of different agent subclasses. Loop through the list and call handle() or receive() on each. Show that the same method call produces different output per agent type. This is the definition of polymorphism.




Q5: My orchestrator completes but only chains 2 messages instead of 3. What’s wrong?

A: Check that your agent’s process() method returns the next A2AMessage (not None) for non-terminal agents. Terminal agents (e.g., Writer) should return None to stop the chain. Also verify your max_hops parameter is high enough.




Q6: Does the report count toward the word count or page limit?

A: The report should be 4–6 pages. Code is submitted separately in the notebook and does NOT count toward the report’s page limit. Keep your report focused on design decisions, analysis, and insights — not on re-explaining code line by line.




Q7: Can I add bonus features like a UI or database integration?

A: Yes, bonus features are welcome and will be noted positively, but they will not compensate for missing core requirements. Complete all 7 tasks before adding extras.




Q8: What if two of my agents have overlapping capabilities?

A: This is an expected edge case. You must demonstrate awareness of it (show what happens with first-match routing) and either resolve it with priority routing or discuss it in your analysis section.






Instructor Note

This assignment is designed to simulate real-world multi-agent system design. There is no single correct answer.


What matters is:


  • Clarity of reasoning — Can you explain why you made each design decision?

  • Quality of implementation — Is your code modular, extensible, and well-documented?

  • Depth of analysis — Do you understand the trade-offs between routing strategies, the risks of delegation chains, and the importance of context management?





Call to Action

Ready to transform your business with AI-powered intelligence that accelerates insights, enhances decision-making, and unlocks the full value of your data?


Codersarts is here to help you turn complex data workflows into efficient, scalable, and evidence-driven AI systems that empower teams to make smarter, faster, and more confident decisions.


Whether you’re a startup looking to build AI-driven products, an enterprise aiming to optimize operations through data science, or a research organization advancing innovation with intelligent data solutions, we bring the expertise and experience needed to design, develop, and deploy impactful AI systems that drive measurable business outcomes.




Get Started Today



Schedule an AI & Data Science Consultation:

Book a 30-minute discovery call with our AI strategists and data science experts to discuss your challenges, identify high-impact opportunities, and explore how intelligent AI solutions can transform your workflows and performance.




Request a Custom AI Demo:

Experience AI in action with a personalized demonstration built around your business use cases, datasets, operational environment, and decision workflows — showcasing practical value and real-world impact.









Transform your organization from data accumulation to intelligent decision enablement — accelerating insight generation, improving operational efficiency, and strengthening competitive advantage.


Partner with Codersarts to build scalable AI solutions including RAG systems, predictive analytics platforms, intelligent automation tools, recommendation engines, and custom machine learning models that empower your teams to deliver exceptional results.


Contact us today and take the first step toward next-generation AI and data science capabilities that grow with your business ambitions.





Comments


bottom of page