from upsonic.tools.builtin_tools import WebFetchTool
from upsonic import Agent, Task
from upsonic.models.anthropic import AnthropicModel
model = AnthropicModel(
model_name="claude-sonnet-4-5",
provider="anthropic"
)
# Advanced web fetch with domain filtering and citations
advanced_fetch = WebFetchTool(
max_uses=5,
allowed_domains=["docs.python.org", "wiki.python.org"],
enable_citations=True,
max_content_tokens=2000
)
task = Task(
description="""
Fetch and analyze the following Python documentation pages:
1. https://docs.python.org/3/tutorial/
2. https://docs.python.org/3/library/functions.html
Provide a structured summary of what each page covers.
""",
tools=[advanced_fetch]
)
agent = Agent(model=model, name="Documentation Reader Agent")
result = agent.print_do(task)
print("Result:", result)