Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a production agent's main loop.
Agentic AI
while agent.is_active(): action = agent.[1](input_data) agent.execute(action)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods related to training or saving instead of deciding actions.
✗ Incorrect
The method 'decide_action' is used by the agent to choose what to do next based on input data.
2fill in blank
mediumComplete the code to initialize a production agent with a specific architecture.
Agentic AI
agent = ProductionAgent(architecture=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing architectures meant for static data or batch processing.
✗ Incorrect
Production agents often use reactive architectures to respond quickly to changing environments.
3fill in blank
hardFix the error in the code that updates the agent's state in production.
Agentic AI
def update_state(self, input): self.state = self.state [1] input return self.state
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' replaces the state instead of updating it.
✗ Incorrect
Using '+=' updates the current state by adding new input, which is typical in state updates.
4fill in blank
hardFill in the blank to create a dictionary comprehension that filters agent logs for errors.
Agentic AI
error_logs = {log_id: log for log_id, log in logs.items() if [1] in log} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'startswith' or filtering for 'warning' instead of 'error'.
✗ Incorrect
We check if each log contains the string 'error' to filter error logs.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that maps agent IDs to their status if active.
Agentic AI
active_agents = {agent[1]: agent[2] for agent in agents if agent.status [3] 'active'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' or wrong property names.
✗ Incorrect
We map agent.id to agent.status only if the status equals 'active'.
