Bird
Raised Fist0
Agentic AIml~10 mins

AGI implications for agent design in Agentic AI - Interactive Code Practice

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Arandom.choice(actions)
Bchoose_best_action(state)
Cprint(state)
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a random action instead of the best one.
Returning None instead of an action.
2fill in blank
medium

Complete 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'
Aclear
Bremove
Cappend
Dignore
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove or clear which deletes data.
Ignoring new information.
3fill in blank
hard

Fix 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'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Adding cost instead of subtracting.
Multiplying or dividing which changes scale incorrectly.
4fill in blank
hard

Fill 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'
Acalculate_reward(state, action)
Bstate.value
Daction.cost
Attempts:
3 left
💡 Hint
Common Mistakes
Using state.value or action.cost directly instead of reward.
Not filtering positive rewards.
5fill in blank
hard

Fill 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'
Acalculate_reward
Bappend
Cupdate_policy
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using predict instead of update_policy.
Not storing experience in memory.
Skipping reward calculation.

Practice

(1/5)
1. What is a key feature of an AGI agent compared to narrow AI agents?
easy
A. Ability to learn and adapt across many different tasks
B. Designed to perform only one specific task
C. Operates without any safety or ethical considerations
D. Cannot update its knowledge after deployment

Solution

  1. Step 1: Understand AGI capabilities

    AGI agents are designed to handle a wide range of tasks, unlike narrow AI which focuses on one task.
  2. Step 2: Compare options to AGI traits

    Only Ability to learn and adapt across many different tasks describes the broad learning and adaptability of AGI agents.
  3. Final Answer:

    Ability to learn and adapt across many different tasks -> Option A
  4. Quick Check:

    AGI = broad adaptability [OK]
Hint: AGI means many tasks, not just one [OK]
Common Mistakes:
  • Confusing AGI with narrow AI
  • Ignoring adaptability in AGI
  • Assuming AGI ignores safety
2. Which of the following is the correct way to represent an AGI agent's safety check in pseudocode?
easy
A. while safety_check() = True: continue_agent()
B. if safety_check() == False: stop_agent()
C. if safety_check() != False then stop_agent()
D. if safety_check() == False then continue_agent()

Solution

  1. Step 1: Analyze safety check logic

    The agent should stop if the safety check fails (returns False).
  2. Step 2: Match correct syntax and logic

    if safety_check() == False: stop_agent() correctly uses equality check and stops the agent if safety_check() is False.
  3. Final Answer:

    if safety_check() == False: stop_agent() -> Option B
  4. Quick Check:

    Stop if safety fails = if safety_check() == False: stop_agent() [OK]
Hint: Stop agent when safety_check is False [OK]
Common Mistakes:
  • Using assignment '=' instead of comparison '=='
  • Confusing True and False conditions
  • Incorrect syntax like 'then' in Python
3. Consider this pseudocode for an AGI agent updating its knowledge:
knowledge = {"facts": 10}
new_info = 5
knowledge["facts"] += new_info
print(knowledge["facts"])
What will be the output?
medium
A. TypeError
B. 10
C. 5
D. 15

Solution

  1. Step 1: Understand dictionary update

    The dictionary key "facts" starts at 10, then 5 is added to it.
  2. Step 2: Calculate the new value

    10 + 5 = 15, so printing knowledge["facts"] outputs 15.
  3. Final Answer:

    15 -> Option D
  4. Quick Check:

    10 + 5 = 15 [OK]
Hint: Add values inside dictionary keys correctly [OK]
Common Mistakes:
  • Thinking print shows old value
  • Confusing key access syntax
  • Expecting error from adding integers
4. This pseudocode is intended to stop an AGI agent if it detects unsafe behavior:
if not safety_check():
    continue_agent()
else:
    stop_agent()
What is the error in this code?
medium
A. The agent continues when safety fails instead of stopping
B. The safety_check function is called incorrectly
C. The else block should be removed
D. The indentation is wrong

Solution

  1. Step 1: Analyze safety logic

    If safety_check() returns False, 'not safety_check()' is True, so continue_agent() runs.
  2. Step 2: Identify intended behavior

    The agent should stop if safety fails, but code continues instead, which is wrong.
  3. Final Answer:

    The agent continues when safety fails instead of stopping -> Option A
  4. Quick Check:

    Fail safety means stop, not continue [OK]
Hint: Fail safety means stop agent, not continue [OK]
Common Mistakes:
  • Mixing up continue and stop actions
  • Misreading 'not' condition
  • Assuming else block fixes logic
5. An AGI agent must adapt safely when learning new tasks. Which design approach best supports this?
hard
A. Use random task switching without monitoring outcomes
B. Allow unrestricted learning to maximize adaptability without checks
C. Implement continuous learning with strict safety constraints and ethical rules
D. Freeze the agent after initial training to avoid errors

Solution

  1. Step 1: Consider adaptability and safety needs

    AGI agents must learn continuously but also avoid unsafe or unethical actions.
  2. Step 2: Evaluate options for safe adaptation

    Only Implement continuous learning with strict safety constraints and ethical rules combines continuous learning with safety and ethics, ensuring responsible adaptation.
  3. Final Answer:

    Implement continuous learning with strict safety constraints and ethical rules -> Option C
  4. Quick Check:

    Safe continuous learning = Implement continuous learning with strict safety constraints and ethical rules [OK]
Hint: Combine learning with safety and ethics [OK]
Common Mistakes:
  • Ignoring safety in continuous learning
  • Freezing agent limits adaptability
  • Random switching causes unsafe behavior