Skip to main content
Deprecated: UrlContextTool is deprecated. Use WebFetchTool instead, which provides the same functionality with additional configuration options.

Overview

Allows models to access and read contents from URLs directly.

Usage

from upsonic import Agent, Task
from upsonic.tools.builtin_tools import UrlContextTool

# Create URL context tool
url_tool = UrlContextTool()

# Create task
task = Task(
    description="Read content from https://docs.python.org and explain Python basics.",
    tools=[url_tool]
)

# Create agent with Google model (required for UrlContextTool)
agent = Agent(
    model="google-gla/gemini-2.5-pro",
    name="URL Context Agent"
)

# Execute
result = agent.print_do(task)
print("Result:", result)

Advanced Example

from upsonic.tools.builtin_tools import UrlContextTool
from upsonic import Agent, Task

url_tool = UrlContextTool()

# Multiple URL access task
task = Task(
    description="""
    Access and analyze these documentation pages:
    1. https://docs.python.org
    2. https://www.python.org/dev/peps/

    Provide a summary of Python's key features and recent PEPs
    """,
    tools=[url_tool]
)

agent = Agent(model="google-gla/gemini-2.5-pro", name="Multi-URL Agent")
result = agent.print_do(task)
print("Result:", result)

Parameters

  • No configuration parameters (provider-managed)

Provider Support

  • Google: ✅ Exclusive support
  • Other providers: ❌ Not supported

Characteristics

  • Direct URL content access
  • Provider-managed fetching and parsing
  • Automatic handling of different content types
  • Built-in security and validation