File size: 1,746 Bytes
25732fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | class MessageProtocols:
"""
Defines standard message structures and types for agent communication.
Ensures all agents speak the same 'language'.
"""
# Message Types
KNOWLEDGE_REQUEST = 'knowledge_request'
KNOWLEDGE_RESPONSE = 'knowledge_response'
LEARNING_COMPLETE = 'learning_complete'
CONTENT_REQUEST = 'content_request'
ASSESSMENT_RESULT = 'assessment_result'
@staticmethod
def request_student_profile(user_id, topic_id=None):
"""Teaching Agent -> Knowledge Agent"""
return {
'type': MessageProtocols.KNOWLEDGE_REQUEST,
'user_id': user_id,
'topic_id': topic_id,
'fields': ['knowledge_level', 'learning_style', 'weak_areas', 'frustration_level']
}
@staticmethod
def provide_student_profile(user_id, profile_data):
"""Knowledge Agent -> Teaching Agent"""
return {
'type': MessageProtocols.KNOWLEDGE_RESPONSE,
'user_id': user_id,
'profile': profile_data
}
@staticmethod
def notify_assessment_complete(user_id, topic_id, score, details):
"""Assessment Agent -> Knowledge Agent"""
return {
'type': MessageProtocols.ASSESSMENT_RESULT,
'user_id': user_id,
'topic_id': topic_id,
'score': score,
'details': details
}
@staticmethod
def request_content_generation(topic_id, content_type, difficulty):
"""Coordinator -> Specialist Agent"""
return {
'type': MessageProtocols.CONTENT_REQUEST,
'topic_id': topic_id,
'content_type': content_type,
'difficulty': difficulty
}
|