agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[ScrapeGraphTools(enable_crawl=True, crawl_max_wait=600)],
markdown=True,
)
agent.print_response(
"""Crawl https://books.toscrape.com with max_depth=2, max_pages=5.
Use this schema: {"type": "object", "properties": {"books": {"type": "array", "items": {"type": "object", "properties": {"title": {"type": "string"}, "price": {"type": "string"}}}}}}.
Prompt: 'Extract every book title and price on the page'. Return the merged JSON.""",
stream=True,
)