Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create multiple agents running in parallel.
Agentic AI
agents = [Agent() for _ in range([1])]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 agents means no agents run.
Using 1 agent does not scale horizontally.
✗ Incorrect
We create 5 agents to scale horizontally by running multiple instances.
2fill in blank
mediumComplete the code to start all agents asynchronously.
Agentic AI
results = await asyncio.gather(*[agent.[1]() for agent in agents])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
stop() or pause() will not start the agents.Using
run() might be valid but here the method is start().✗ Incorrect
We use start() to begin each agent's task asynchronously.
3fill in blank
hardFix the error in the code to correctly collect agent outputs.
Agentic AI
outputs = [agent.[1]() for agent in agents] results = await asyncio.gather(*outputs)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using synchronous methods causes errors with
await.Using
run() or execute() may not be async.✗ Incorrect
The start() method is asynchronous and returns a coroutine to await.
4fill in blank
hardFill both blanks to create a dictionary of agent results filtered by success.
Agentic AI
success_results = {agent.id: result for agent, result in zip(agents, results) if result [1] [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
!= False works but is less clear.Using
== False filters failures, not successes.✗ Incorrect
We filter results where result == True to keep only successful outputs.
5fill in blank
hardFill all three blanks to aggregate agent outputs into a summary dictionary.
Agentic AI
summary = [1](agent.id: [2] for agent, [3] in zip(agents, results))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for both zipped elements causes confusion.
Not using
dict to convert the generator to a dictionary.✗ Incorrect
We use dict to build a dictionary from a generator expression. The loop variables are agent and item (the result).
