Complete the code to define an AGI agent's basic decision function.
def decide_action(state): return [1]
The agent must select the best action based on the current state, so choose_best_action(state) is correct.
Complete the code to update the agent's knowledge after receiving new information.
def update_knowledge(agent, info): agent.knowledge_base.[1](info)
The agent should add new information to its knowledge base, so append is the correct method.
Fix the error in the agent's reward calculation function.
def calculate_reward(state, action): reward = state.get('value', 0) [1] action.cost return reward
The reward should be the state's value minus the action's cost, so - is correct.
Fill both blanks to create a dictionary comprehension that maps states to their rewards if reward is positive.
rewards = {state: [1] for state, action in actions.items() if [2] > 0}The dictionary maps each state to its reward calculated by calculate_reward(state, action). The filter keeps only positive rewards.
Fill all three blanks to define an AGI agent's learning step with state, action, and reward updates.
def learning_step(agent, state, action): reward = [1](state, action) agent.memory.[2]((state, action, reward)) agent.policy = [3](agent.memory)
The agent calculates the reward, appends the experience to memory, and updates its policy based on memory.
