The Agents SDK is built around a simple abstraction: an agent is an LLM paired with callable tools, a system prompt, and configurable guardrails. Tools are Python functions decorated with metadata describing their purpose and parameters. To give an agent web access, the developer registers a tool that accepts a URL or search query, routes the request through a proxy endpoint, and returns the content as a string for the model to reason over.
A minimal integration wraps a requests.get call inside a tool function, routing traffic through a rotating residential proxy gateway. Each invocation receives a fresh IP, preventing target sites from correlating sequential fetches. For JavaScript-heavy targets, the tool can call a scraper API that handles headless rendering and returns fully rendered HTML or pre-parsed JSON, eliminating the need to run browser instances alongside the agent.
Session management becomes important when the agent performs multi-page workflows — navigating pagination, following redirects, or interacting with authenticated portals. The SDK supports stateful tool execution through context variables that persist across turns. By storing a proxy session token in the agent's context, subsequent tool calls reuse the same sticky IP, maintaining cookies and authentication throughout the workflow.
Error handling deserves careful design. Proxy requests can fail due to rate limits, CAPTCHAs, or transient network issues. A robust tool wraps each fetch in a retry loop with exponential backoff, rotates to a new session after repeated failures, and returns a structured error message. The agent can then decide to retry, skip the source, or inform the user that a data point is temporarily unavailable.