Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a basic message format for agent communication.
Agentic_ai
message = {"sender": "AgentA", "receiver": "AgentB", "content": [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to send a message using a standard send function.
Agentic_ai
def send_message(agent, message): agent.[1](message)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the message parsing code to extract the sender correctly.
Agentic_ai
def parse_message(msg): sender = msg[[1]] return sender
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a filter that selects messages sent by 'AgentX' and containing 'urgent'.
Agentic_ai
filtered = [msg for msg in messages if msg[[1]] == 'AgentX' and 'urgent' [2] msg["content"]]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to build a dictionary comprehension mapping agent names to their last received message content.
Agentic_ai
last_messages = {agent: messages[-1][[1]] for agent, messages in [2].items() if messages and messages[-1][[3]] == agent} Drag options to blanks, or click blank then click option'
Attempts:
3 left
