Bird
Raised Fist0
Agentic AIml~20 mins

Self-improving agents in Agentic AI - Practice Problems & Coding Challenges

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
Challenge - 5 Problems
🎖️
Self-Improver Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is a key characteristic of a self-improving agent?

Which of the following best describes a self-improving agent in AI?

AAn agent that randomly changes its behavior without evaluation.
BAn agent that requires manual updates from developers to improve.
CAn agent that can modify its own code or parameters to improve performance over time.
DAn agent that only follows fixed rules without any learning capability.
Attempts:
2 left
💡 Hint

Think about what makes an agent improve itself without external help.

Model Choice
intermediate
2:00remaining
Choosing a model architecture for a self-improving agent

You want to build a self-improving agent that learns from its past decisions and adapts its strategy. Which model architecture is most suitable?

AA reinforcement learning model with policy gradient methods.
BA simple linear regression model without feedback.
CA clustering algorithm that groups data points.
DA static decision tree with fixed rules.
Attempts:
2 left
💡 Hint

Consider models that learn from interaction and improve policies over time.

Metrics
advanced
2:00remaining
Evaluating improvement in a self-improving agent

Which metric is most appropriate to measure the improvement of a self-improving agent over multiple training episodes?

AAverage cumulative reward per episode.
BMean squared error on a fixed test set.
CNumber of parameters in the model.
DTraining time per epoch.
Attempts:
2 left
💡 Hint

Think about a metric that reflects how well the agent performs its task over time.

🔧 Debug
advanced
2:00remaining
Debugging a self-improving agent stuck in local optimum

An agent using reinforcement learning is stuck with poor performance and does not improve despite training. What is the most likely cause?

AThe agent's model architecture is too complex.
BThe agent's learning rate is too high, causing unstable updates.
CThe reward function is too sparse, providing no feedback.
DThe agent's exploration rate is too low, causing it to exploit suboptimal actions.
Attempts:
2 left
💡 Hint

Consider why the agent might not try new actions to find better solutions.

Predict Output
expert
2:00remaining
Output of a self-modifying agent code snippet

Consider this Python code simulating a simple self-improving agent that updates its parameter to maximize reward. What is the output after running it?

Agentic AI
class SelfImprovingAgent:
    def __init__(self):
        self.param = 0
    def reward(self):
        return -(self.param - 5) ** 2 + 10
    def improve(self):
        best_param = self.param
        best_reward = self.reward()
        for delta in [-1, 1]:
            candidate = self.param + delta
            candidate_reward = -(candidate - 5) ** 2 + 10
            if candidate_reward > best_reward:
                best_param = candidate
                best_reward = candidate_reward
        self.param = best_param
agent = SelfImprovingAgent()
for _ in range(3):
    agent.improve()
print(agent.param)
A4
B3
C5
D2
Attempts:
2 left
💡 Hint

Trace the parameter updates step by step to see where it converges after 3 improvements.

Practice

(1/5)
1. What is the main idea behind a self-improving agent in AI?
easy
A. It learns from its own actions to get better over time.
B. It only follows fixed rules without changing.
C. It requires constant manual updates to improve.
D. It ignores feedback from the environment.

Solution

  1. Step 1: Understand the agent's learning process

    A self-improving agent learns by trying actions and observing results to improve itself.
  2. Step 2: Compare options to the definition

    Only It learns from its own actions to get better over time. describes learning from its own actions to improve over time.
  3. Final Answer:

    It learns from its own actions to get better over time. -> Option A
  4. Quick Check:

    Self-improving means learning from actions = B [OK]
Hint: Self-improving means learning and updating itself [OK]
Common Mistakes:
  • Thinking it never changes (fixed rules)
  • Assuming manual updates are needed
  • Ignoring feedback from environment
2. Which of the following is the correct way to represent a self-improving agent's update step in pseudocode?
easy
A. agent.reset() every time without learning
B. agent.run() without feedback
C. agent.update(learn_from=agent.actions, feedback=environment.results)
D. agent.ignore(environment.results)

Solution

  1. Step 1: Identify update step involving learning

    The agent must update itself using its actions and feedback from the environment.
  2. Step 2: Match options to update logic

    Only agent.update(learn_from=agent.actions, feedback=environment.results) shows the agent updating by learning from its actions and feedback.
  3. Final Answer:

    agent.update(learn_from=agent.actions, feedback=environment.results) -> Option C
  4. Quick Check:

    Update with actions and feedback = A [OK]
Hint: Update means learning from actions and feedback [OK]
Common Mistakes:
  • Ignoring feedback in update
  • Resetting without learning
  • Running without update
3. Consider this pseudocode for a self-improving agent:
actions = ['move', 'turn', 'scan']
results = [True, False, True]
agent_knowledge = {'move': 0.5, 'turn': 0.5, 'scan': 0.5}

for i in range(len(actions)):
    if results[i]:
        agent_knowledge[actions[i]] += 0.1
    else:
        agent_knowledge[actions[i]] -= 0.1

print(agent_knowledge)
What will be the printed output?
medium
A. SyntaxError
B. {'move': 0.6, 'turn': 0.4, 'scan': 0.6}
C. {'move': 0.4, 'turn': 0.6, 'scan': 0.4}
D. {'move': 0.5, 'turn': 0.5, 'scan': 0.5}

Solution

  1. Step 1: Analyze loop updates on knowledge

    For each action, if result is True, add 0.1; if False, subtract 0.1.
  2. Step 2: Calculate final values

    'move': 0.5 + 0.1 = 0.6; 'turn': 0.5 - 0.1 = 0.4; 'scan': 0.5 + 0.1 = 0.6.
  3. Final Answer:

    {'move': 0.6, 'turn': 0.4, 'scan': 0.6} -> Option B
  4. Quick Check:

    True adds 0.1, False subtracts 0.1 = D [OK]
Hint: Add 0.1 for True, subtract 0.1 for False in order [OK]
Common Mistakes:
  • Not updating values correctly
  • Mixing True and False effects
  • Assuming no change
4. This code tries to update an agent's knowledge but has a bug:
actions = ['jump', 'run']
results = [True, False]
knowledge = {'jump': 0.3, 'run': 0.7}

for i in range(len(actions)):
    if results[i]:
        knowledge[actions[i]] += 0.1
    else:
        knowledge[actions[i]] =- 0.1

print(knowledge)
What is the bug and how to fix it?
medium
A. The operator '= -' should be '-=' to subtract; fix: change to '-='.
B. The list lengths mismatch; fix by adding more results.
C. The dictionary keys are missing; fix by adding keys.
D. The print statement is incorrect; fix by using print(knowledge.values()).

Solution

  1. Step 1: Identify the incorrect operator

    The code uses '= - 0.1' which assigns negative 0.1 instead of subtracting.
  2. Step 2: Correct the operator to '-='

    Changing '= -' to '-=' correctly subtracts 0.1 from the current value.
  3. Final Answer:

    The operator '= -' should be '-=' to subtract; fix: change to '-='. -> Option A
  4. Quick Check:

    Use '-=' to subtract, not '= -' = C [OK]
Hint: Use '-=' to subtract, not '= -' [OK]
Common Mistakes:
  • Confusing '= -' with '-=' operator
  • Ignoring operator syntax errors
  • Thinking print statement causes error
5. You want to design a self-improving agent that adapts to changing environments by updating its strategy based on success rates. Which approach best fits this goal?
hard
A. Manually update the agent's strategy after every 100 actions.
B. Fix the agent's strategy and never update it to keep consistency.
C. Randomly change strategies without considering past results.
D. Use a feedback loop where the agent tries actions, measures success, and updates probabilities accordingly.

Solution

  1. Step 1: Understand the goal of adapting strategies

    The agent must learn from success rates and update its strategy automatically.
  2. Step 2: Evaluate options for self-improvement

    Only Use a feedback loop where the agent tries actions, measures success, and updates probabilities accordingly. describes a feedback loop that updates based on success, matching self-improving behavior.
  3. Final Answer:

    Use a feedback loop where the agent tries actions, measures success, and updates probabilities accordingly. -> Option D
  4. Quick Check:

    Feedback loop with updates = A [OK]
Hint: Use feedback loops to update strategy automatically [OK]
Common Mistakes:
  • Fixing strategy without updates
  • Changing randomly without feedback
  • Relying on manual updates only