GUIDES

Research Agent

Watch an AI search the web in real-time with full observability into every step.

The Research Agent lets you ask a question and watch an LLM search the web, read pages, and compile a research report — all streamed live to your screen. Every search query, every page fetched, and every reasoning step is visible in real-time.

How It Works

  1. You ask a question — anything you'd normally research across multiple websites.
  2. The agent searches — it calls the link.sc Search API to find relevant results.
  3. The agent reads — it fetches and reads promising pages using the link.sc Fetch API.
  4. The agent reasons — it decides whether to search again, read more pages, or compile its answer.
  5. You get a report — a structured answer with source attribution, delivered as a stream.

Every step is streamed as a Server-Sent Event (SSE), so you can watch the agent think in real-time.

Try It in the Playground

The fastest way to try the Research Agent is the Playground. Select the Research tab, enter a question, and click Run.

You'll see a live timeline showing:

  • Search events — what the agent is searching for
  • Fetch events — which pages it's reading
  • Decision events — what it found and how it's reasoning
  • The final report — with total steps, duration, and token usage

API Reference

Endpoint

POST /api/agent/research

This endpoint requires session authentication (you must be logged into the dashboard). It is not available via API key.

Request

{
  "query": "What are the latest developments in quantum computing?"
}
Field Type Required Description
query string Yes The research question. Max 500 characters.

Response

The response is a text/event-stream (SSE). Each event is a JSON object:

data: {"type":"thinking","step":0,"timestamp":142,"data":{"message":"Analyzing your research question..."}}
data: {"type":"search","step":1,"timestamp":850,"data":{"query":"quantum computing breakthroughs 2026"}}
data: {"type":"decision","step":1,"timestamp":2100,"data":{"message":"Found 8 results","results":[...]}}
data: {"type":"fetch","step":2,"timestamp":2300,"data":{"url":"https://example.com/article"}}
data: {"type":"result","step":2,"timestamp":8500,"data":{"answer":"...","totalSteps":4,"totalTokens":12000,"durationMs":8500}}
data: [DONE]

Event Types

Type Description
thinking The agent is reasoning about what to do next
search The agent is executing a web search
fetch The agent is fetching a web page
decision The agent evaluated results and made a decision
result Final research report with answer and metadata
error Something went wrong during a step
limit A guardrail was hit (step limit, timeout, or token budget)

Guardrails

The Research Agent has built-in safety limits to prevent abuse and runaway costs:

Guardrail Limit
Authentication Dashboard session required
Steps per session 10 tool calls max
Sessions per hour 5 per user
Query length 500 characters max
Token budget 32,000 tokens per session
Session timeout 2 minutes
Content per page 8,000 characters (truncated)
Content filtering Harmful query patterns blocked

All tool calls (searches and fetches) go through the standard link.sc API pipeline, so they count against your normal usage quota and benefit from the same proxy rotation, anti-bot bypass, and caching infrastructure.

Example: Consuming the SSE Stream

const response = await fetch('/api/agent/research', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: 'What is the current state of fusion energy?' }),
});

const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  buffer += decoder.decode(value, { stream: true });
  const lines = buffer.split('\n\n');
  buffer = lines.pop();

  for (const line of lines) {
    const data = line.replace(/^data: /, '');
    if (data === '[DONE]') break;

    const event = JSON.parse(data);
    console.log(`[${event.type}] Step ${event.step}:`, event.data);
  }
}

Architecture

Under the hood, the Research Agent uses:

  • Bifrost AI Gateway — standardizes LLM calls across OpenAI, Anthropic, and other providers
  • link.sc Search API — for real-time web search (web_search tool)
  • link.sc Fetch API — for page content extraction (fetch_url tool)
  • OpenAI function calling — the LLM decides which tools to use and when to stop

The agent runs a tool-calling loop: it sends your question to the LLM, the LLM requests tool calls (search or fetch), we execute them through link.sc's API, feed results back, and repeat until the LLM has enough information to answer.