Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define an AGI agent's basic decision function.
Agentic_ai
def decide_action(state): return [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to update the agent's knowledge after receiving new information.
Agentic_ai
def update_knowledge(agent, info): agent.knowledge_base.[1](info)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the agent's reward calculation function.
Agentic_ai
def calculate_reward(state, action): reward = state.get('value', 0) [1] action.cost return reward
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary comprehension that maps states to their rewards if reward is positive.
Agentic_ai
rewards = {state: [1] for state, action in actions.items() if [2] > 0} Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to define an AGI agent's learning step with state, action, and reward updates.
Agentic_ai
def learning_step(agent, state, action): reward = [1](state, action) agent.memory.[2]((state, action, reward)) agent.policy = [3](agent.memory)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
