Estimated time: 2–3 hours
You have built the Agent class in Lesson 15. Now you will build a real research agent on top of it that can answer multi-hop questions requiring several chained searches and calculations. The agent must use the raw OpenAI SDK only — no LangChain, LangGraph, or PydanticAI.
A multi-hop question is one that requires chaining lookups — you need the answer to step 1 to know what to search for in step 2. Example: “Who is the CEO of the company that makes the Vision Pro, and how long have they held that role?”
Your agent must have at least these five tools:
search_web(query: str) → str — Use either Tavily (free tier available) or a DuckDuckGo scraper. If using a mock, return plausible static results but note it clearly in the output.get_current_date() → str — Returns today’s date in ISO format.calculate(expression: str) → str — Evaluates safe arithmetic.summarise_content(content: str, focus: str) → str — An LLM call that distils a long search result down to the key facts relevant to focus. This is a “sub-call” tool — the agent calls a second LLM to process content before continuing.check_fact(claim: str, context: str) → str — An LLM call that checks whether a specific claim is supported by the provided context. Returns “supported”, “unsupported”, or “uncertain” with a one-sentence explanation.Your agent must correctly answer all four of these (or similar questions of equal complexity):
For questions 3 and 4: if using a mock search tool, write mock results that contain the correct information. The point is to verify the agent reasons through multi-step lookups correctly — not to have a live internet connection.
For each run, print a log in this format:
--- Question 3 ---
[Iter 1] Tool: search_web(query="OpenAI founders") → 412 chars
[Iter 2] Tool: summarise_content(content=..., focus="founders") → 89 chars
[Iter 3] Tool: search_web(query="OpenAI current CEO 2026") → 387 chars
[Iter 4] Final answer (no tool call)
Answer: OpenAI was founded in 2015 by Sam Altman, Greg Brockman, Ilya Sutskever...
Tokens: 2,847 | Iterations: 4
Agent / Tool classes from Lesson 15 (with any additions you need)summarise_content and check_fact must make a real second LLM call (not just return the input unchanged)Agent and Tool classes from Lesson 15.max_iterations=2 and running question 3.summarise_content and check_fact make a second LLM callmax_iterations=2 triggers the abort path correctlycheck_fact call that verifies each factual claim and produces a confidence summary.ConversationalAgent from Lesson 15 and maintain history across five sequential questions.Finished this project? Share your GitHub repo link in the discussion below. Browse what others built to get inspiration and give feedback.