openai-agents-contextfetch
ContextFetch web search and page reading as function tools for the OpenAI Agents SDK.
pip install openai-agents-contextfetch
export CONTEXTFETCH_API_KEY="your-api-key" # optional: without a key, requests use the keyless tier
from agents import Agent, Runner
from openai_agents_contextfetch import contextfetch_tools
agent = Agent(name="Researcher", instructions="Answer with sources.", tools=contextfetch_tools())
result = Runner.run_sync(agent, "What changed in the latest Python release?")
print(result.final_output)
Tools
contextfetch_search(query, include_domains?, exclude_domains?, start_published_date?): web search. Returns a list of{title, url, published_date, content}, wherecontentis the page as Markdown: by default only the parts relevant to the query.contextfetch_read(url, query?): one page as Markdown. Withquery, only the parts relevant to it.
API errors (bad URL, no credits, rate limit) go back to the model as the tool output, with the API's message.
Options
contextfetch_tools(
api_key=None, # defaults to CONTEXTFETCH_API_KEY
num_results=5, # results per search, 1 to 25
content="pruned_context", # or "text" for whole pages
)
Without this package
The same tools are available over MCP: npx -y @contextfetch/mcp with the SDK's MCPServerStdio.
Tests
uv run --group test pytest tests # unit tests, no network
CONTEXTFETCH_API_KEY=... uv run --group test pytest tests/test_live.py # live, 2 credits
Tested with openai-agents 0.20.0, 0.22.0 and 0.24.0. MIT licensed.
Metadata
Release files for openai-agents-contextfetch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| openai_agents_contextfetch-0.1.0.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openai_agents_contextfetch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / openai_agents_contextfetch-0.1.0.tar.gz
| Download URL | openai_agents_contextfetch-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccbde47ea58596d06eaaffe1836aae4141bf87d433e3eea69ffa9218aa71d52a
|
|
BLAKE2b-256 checksum How to use checksums |
dff878c5cf6a08ca0960babef32cb883760c1687026b78ae65243e362f446a78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / openai_agents_contextfetch-0.1.0-py3-none-any.whl
| Download URL | openai_agents_contextfetch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3181ffdf0823e3052f26980400928de60f6590cefa2a6d4a2b721c76f304de3a
|
|
BLAKE2b-256 checksum How to use checksums |
98b9f858d2ab3e93aaa7024b2345ffd1692b0a79af3521e4d20145ee41e572c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for openai-agents-contextfetch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.