Integrate

Monitor web changes with the OpenAI Agents SDK

The OpenAI Agents SDK is a clean way to give a model tools and run it in a loop. What it lacks is a sense of the outside web changing. Hypeline provides that: a deduplicated stream of genuinely-new-content events. Expose it as a function tool the agent calls, and run a deployed loop that wakes the agent the moment a source changes.

The mental model: function tool plus a deployed loop

A deployed agent can pull and be pushed to. The function tool lets the model fetch deduplicated changes on demand as it reasons. The outer loop subscribes to the Hypeline stream over SSE and runs the agent once per real change, so it reacts instead of polling. Both use the same events on one stable schema.

Expose Hypeline as a function tool

tools.py
# pip install hypeline openai-agents
from agents import function_tool
from hypeline import Hypeline

hy = Hypeline("hype_...")

@function_tool
def get_changes(cursor: str) -> str:
    """Fetch deduplicated web changes since a cursor."""
    page = hy.get_changes_since(cursor=cursor)
    return "\n".join(f"{e.title}: {e.url}" for e in page.events) or "no new changes"

@function_tool
def watch_source(url: str) -> str:
    """Start watching a URL for genuinely-new content. Returns a cursor."""
    return hy.create_watch(url).cursor

Run a deployed loop on the stream

Register the sources once, then let the SSE stream wake the agent on each genuinely-new change. If the process restarts, reconnect with your last cursor and the stream resumes in order.

run.py
from agents import Agent, Runner
from tools import get_changes, watch_source

hy.create_watch("https://status.example/", keywords=["incident", "degraded"])

agent = Agent(
    name="incident-watcher",
    instructions="Summarize each real change and decide whether to escalate.",
    tools=[get_changes, watch_source],
)

# The stream drives the agent: one deduplicated event per real change.
for event in hy.stream(keyword="incident"):
    result = Runner.run_sync(
        agent,
        f"A source changed: {event.title} ({event.url}). Decide what to do.",
    )
    print(result.final_output)

The hypeline client is a thin wrapper over the HTTP API: create_watch is POST /v1/sources, get_changes_since is GET /v1/events, and stream() opens the GET /v1/stream Server-Sent Events endpoint, so the same tools and loop work from plain curl.

Why Hypeline, not a page-change checker

  • Deduplicated on extracted content. The agent is woken by real changes to the main text, not by ads, banners, or timestamps.
  • One schema across every source. Feeds, watched pages, and streaming sources arrive as one event, so the tool and the loop have no per-source branching.
  • Cursor resume. Reconnect with your last cursor after a deploy and the stream replays in order, so no change is missed or repeated.
  • Signed events. Content-layer Ed25519 signatures let the agent verify a change before acting on it.
FAQ

Frequently asked questions

Should the agent pull or be pushed to?

Both fit. A deployed agent subscribes to the SSE stream so it runs on each real change, and the function tool lets the model pull more changes on demand while it reasons. Use the tool alone for a purely on-demand agent.

How do I keep the loop from reprocessing changes?

Persist the cursor of the last event you handled. On reconnect, pass it back and the stream resumes strictly after it, so the agent never repeats a change across restarts.

What is in each event?

A versioned record with the source URL, a title, the extracted main content, source type, timestamps, tags, and an Ed25519 signature, identical whether the change came from a feed, a watched page, or a streaming source.

Can the agent add sources at runtime?

Yes. The watch_source tool lets the model start watching a new URL as the task requires, and a matching delete tool can drop one, so the watched set is not fixed.

Give your agents eyes on the web

Add your email and we'll tell you the moment your agents can start watching the web live.

No spam. One email when it goes live.