Bird
0
0

Examine this pipeline code:

medium📝 Debug Q6 of 15
Agentic AI - Real-World Agent Applications
Examine this pipeline code:
agent = Agent()
agent.add_step('load', function=load_data)
agent.add_step('clean', clean_data)
result = agent.run()

What is the issue causing an error?
AStep names must be integers, not strings
BThe 'load' step function is called instead of passed
CThe agent.run() method is not defined
DThe second add_step call is missing the 'function=' keyword
Step-by-Step Solution
Solution:
  1. Step 1: Check add_step syntax

    The first add_step uses function=load_data, correctly passing the function.
  2. Step 2: Identify inconsistency

    The second add_step passes clean_data without the function= keyword, which is required.
  3. Step 3: Confirm other options

    Agent.run() is valid; step names as strings are allowed; functions are passed, not called.
  4. Final Answer:

    The second add_step call is missing the 'function=' keyword -> Option D
  5. Quick Check:

    All add_step calls need 'function=' before function name [OK]
Quick Trick: Always use 'function=' when adding steps [OK]
Common Mistakes:
  • Omitting 'function=' keyword in add_step
  • Calling functions instead of passing them
  • Assuming step names must be numeric

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes