← Back to Build an AI Agent in Python From Scratch

Module: Your First Agent

Practice Test: Your First Agent

Call an LLM from Python, see why the API forgets, and write a working agent loop with tool calling.

9 questions. 15 minutes. You need at least 7 right to pass. This test is optional. It does not mark any lesson complete and it does not count towards your certificate.

Time left: 15:00

1. Why did the second request in forgets.py not know the user's destination?

2. What do you change to point the course code at a hosted provider instead of Ollama?

3. What does finish_reason "length" mean?

4. How does the model signal that the agent loop is finished?

5. What must a tool result message include so the model can match it to its request?

6. Why does the loop use for step in range(max_steps) instead of while True?

7. What type is call.function.arguments in the chat completions response?

8. The model asks for two tool calls in one reply. What should your code send back?

9. In the generated schema, why is days not in required for get_weather(city, days=3)?