Docs target current release v0.7.0.v0.7.1 is under review

Search and web tools

Search and HTTP fetch live in separate modules. Import search from opentine.tools.search; import fetch and fetch_raw from opentine.tools.web.

web_tools.py
1from opentine.tools.search import search
2from opentine.tools.web import fetch, fetch_raw
3
4results = await search("agent artifact provenance", max_results=5)
5text = await fetch("https://example.com", max_chars=8000)
6response = await fetch_raw("https://example.com")
7
8print(response["status"])
9print(response["headers"])
10print(response["body"])
11print(response["untrusted"])  # True

Search provider selection

search() selects Tavily, Exa, or Brave when the corresponding environment key is present. Without one, it falls back to bounded DuckDuckGo HTML results.

Fetch behavior

fetch() validates and pins DNS answers, ignores implicit proxies, refuses unsafe redirects or compressed search responses, strips active markup, and returns bounded text. fetch_raw() returns status, headers, body, and an untrusted marker.

Network policy

The default policy permits HTTPS and blocks private, loopback, link-local, reserved, and multicast addresses. Use an allowlist when an agent only needs known hosts.

network_policy.py
1from opentine.policies import NetworkPolicy
2from opentine.tools.web import fetch
3
4policy = NetworkPolicy(
5    allowed_schemes=("https",),
6    allowed_hosts=("docs.example.com",),
7    allow_private_hosts=False,
8    max_body_bytes=100_000,
9    timeout_seconds=10,
10)
11
12text = await fetch("https://docs.example.com/guide", policy=policy)