from upsonic.tools.builtin_tools import WebSearchTool, WebSearchUserLocation
from upsonic import Agent, Task
from upsonic.models.openai import OpenAIResponsesModel
model = OpenAIResponsesModel(
model_name="gpt-4o",
provider="openai"
)
# Advanced web search with configuration
advanced_search = WebSearchTool(
search_context_size="high", # 'low', 'medium', or 'high'
user_location=WebSearchUserLocation(
city="San Francisco",
country="US",
region="CA",
timezone="America/Los_Angeles"
),
blocked_domains=["example.com", "spam-site.com"],
max_uses=10
)
task = Task(
description="Search for AI trends with high context and location filtering",
tools=[advanced_search]
)
agent = Agent(model=model, name="Advanced Search Agent")
agent.print_do(task)