Build with live web data

How to Build an AI Agent: A Founder's Guide (2026)

Divya Lath
How to Build an AI Agent: A Founder's Guide (2026)

To build an AI agent, you need five parts: a model that decides what to do next, a small set of tools it can call, access to the live web so it can find and check facts, a loop that keeps calling tools until the job is done, and a set of test tasks that tell you whether it works. In 2026 the SDKs handle the loop for you, so a useful first agent is about 60 lines of code. The hard part is choosing the right job, giving the agent good tools, and measuring it honestly.

Building an agent that uses the web? Apply to TinyFish for Startups: free TinySearch and TinyFetch at 4x rate limits, plus up to $12,000 in value.

This guide is written for founders and early engineers. We're TinyFish, and we build the web layer that agents use, so the live-web sections use our API. The rest applies whatever you choose.

At a glance

PartWhat it doesWhat to pick first
ModelReads the task, decides the next stepOne strong general model; tune effort later
ToolsFunctions the model can call3 to 5 tools with clear names and arguments
Live webSearch, read and operate real sitesOne API key: TinySearch, TinyFetch, TinyAgent
LoopCalls tools until the task is doneAn SDK tool runner, not hand-written plumbing
EvalsChecks the agent did the job20 real tasks with known answers
The five parts of an AI agent: model, tools, live web, loop and evals

Step 0: Decide whether you need an agent at all

An agent is a model that chooses its own next step: it can search, read, click, call your APIs, look at the result and decide what to do again. That flexibility costs time and money, and makes behaviour harder to predict. Before you build one, check four things:

  • The task has several steps you can't fully script in advance. "Find the cheapest flight on a route and date" needs searching, filtering and comparing. "Extract the title from this PDF" is one model call.
  • The result is worth the cost and wait. An agent run can take 15 to 60 seconds and several cents. That's fine for a research report, too slow for autocomplete.
  • A model can actually do it. Try the task by hand in a chat app with web access first. If a strong model can't do it there, an agent won't either.
  • Mistakes are recoverable. Start with jobs where a human reviews the output, or where an error is cheap to catch.

If any answer is no, a single model call or a fixed workflow is the better product. Plenty of "agents" in production are really a well-designed pipeline with one model step.

Step 1: Pick one job and write down what "done" means

The most common reason agents fail isn't the model, it's a vague job. Write one sentence for the task and a checklist for the output:

  • Task: "Given a competitor's name, find their current pricing plans and return each plan's name, monthly price and main limit, citing the pricing page."
  • Done when: every plan is listed, every price matches the live page, every row has a source URL, and anything not published is marked as unavailable rather than guessed.

That checklist becomes your system prompt, your output format and your test later.

Step 2: Choose a model

For a first agent, pick one strong general model with good tool use and don't optimise yet. You'll learn more from your first 20 test runs than from any leaderboard.

Things that matter for agents specifically:

  • Tool calling. The model has to pick the right tool and fill in arguments reliably. All the major model APIs support this.
  • Long context. Web pages are long. Models with large context windows can read several pages in one run.
  • Effort controls. Several current models let you turn reasoning depth up or down per request. Start at the default and lower it for simple, high-volume tasks once your tests pass.
  • Price per completed task, not per token. A cheaper model that needs three retries can cost more than a stronger one that gets it right first time.

Our example uses Anthropic's Claude Opus 5.5 through the official Python SDK. Swap in any model with tool calling; the structure stays the same.

Step 3: Give it a few good tools

Tools are just functions with a name, a description and typed arguments. The model reads the descriptions to decide what to call, so write them like documentation for a new teammate.

Rules that save a lot of debugging:

  • Start with 3 to 5 tools. More tools means more wrong choices.
  • One clear job per tool. "search_web" and "read_page", not "do_web_stuff".
  • Describe when to use it, not just what it does. "Use only when a page needs clicks or forms."
  • Return compact, structured results. Trim long outputs so one page doesn't fill the model's context.
  • Return errors as text the model can act on ("No results for that query, try a broader search"), rather than crashing the run.

Step 4: Give it the live web

Most useful agents need facts that change: prices, docs, jobs, news, availability. A model's training data is months old, so the agent needs to search and read the web as it runs. That usually means three abilities:

  1. Search for pages that might answer the question.
  2. Read a page and get clean text without menus, ads and cookie banners.
  3. Operate a site when the answer sits behind a search form, filters or clicks.

With TinyFish these are all behind one API and one API key: TinySearch returns ranked results with titles, URLs and snippets, TinyFetch returns clean page content for up to 10 URLs per request, and TinyAgent runs a real browser from a plain-English goal.

TinySearch playground: a query returns ranked live results with titles, URLs and snippets
TinyFetch playground: a URL is fetched and returned as clean markdown ready for a model
TinyAgent playground: the agent opens a product page and returns name, rating, review count, stock and price as JSON

In the last recording, the goal was to open an Amazon product page and extract the product name, displayed price, star rating, review count and availability, closing a cookie banner first if one appeared. The agent returned those fields as JSON.

On our benchmarks page (updated July 2026), TinyFish's web agent scored 89.9% on the Online-Mind2Web benchmark against 69.0% for the next best (Gemini 2.5 Computer Use), and TinyFetch returned usable context for 93% of pages in our fetch quality eval against 80% for Tavily. Run your own tests on your own sites before you trust anyone's benchmark, ours included.

Step 5: Run the loop

The agent loop is simple: send the task and tool definitions to the model; if it asks for a tool, run it and send back the result; repeat until it answers. Current SDKs include a tool runner that does this for you. Here's a complete agent with three web tools:

Python
# pip install anthropic tinyfish
# export ANTHROPIC_API_KEY=... TINYFISH_API_KEY=...
import anthropic
from anthropic import beta_tool
from tinyfish import TinyFish

claude = anthropic.Anthropic()
web = TinyFish()


@beta_tool
def search_web(query: str) -> str:
    """Search the live web. Returns ranked results with titles, URLs and snippets.

    Args:
        query: What to search for, in plain words.
    """
    return web.search.query(query, location="US", language="en").model_dump_json()


@beta_tool
def read_page(url: str) -> str:
    """Read a public web page and return its clean text.

    Args:
        url: The full URL of the page to read.
    """
    return web.fetch.get_contents(urls=[url]).model_dump_json()[:30000]


@beta_tool
def use_website(url: str, goal: str) -> str:
    """Operate a real website (forms, filters, clicks) to finish a goal.

    Args:
        url: The page where the browser should start.
        goal: What to do, and exactly which fields to return.
    """
    return web.agent.run(url=url, goal=goal).model_dump_json()


runner = claude.beta.messages.tool_runner(
    model="claude-opus-5-5",
    max_tokens=16000,
    system=(
        "You answer questions using the live web. Cite the URL for every fact. "
        "Use use_website only when a page needs clicks or forms. "
        "If you can't find something, say so instead of guessing."
    ),
    tools=[search_web, read_page, use_website],
    messages=[{
        "role": "user",
        "content": "What do the three biggest website builders charge for "
                   "their cheapest paid plan? Cite each pricing page.",
    }],
)

final = runner.until_done()
print("".join(block.text for block in final.content if block.type == "text"))

What's happening:

  • The `@beta_tool` decorator turns each function's signature and docstring into a tool definition the model can read.
  • The tool runner sends the request, runs whichever tools the model asks for, feeds the results back, and stops when the model gives a final answer.
  • TinySearch and TinyFetch are free within their limits (30 searches and 150 fetched URLs a minute on default accounts). The `use_website` tool calls TinyAgent, which costs $0.016 per step from your wallet.

If you'd rather not write code yet, you can connect TinyFish to Claude, ChatGPT, Cursor or Codex through our MCP server and try the same tasks in chat first. See the docs for each client.

Step 6: Write goals the agent can't misread

Whether the model writes the goal or you do, browser goals succeed or fail on specifics. A goal that works well:

Text
Find the five cheapest one-way economy flights from Ho Chi Minh City (SGN) to Hanoi (HAN)
on February 4, 2027, for 1 adult. Compare the airline, departure time, arrival time and price,
and tell me which flight is cheapest. Don't book or enter personal information.

It names the exact fields, the number of results, the date and passenger count, and what not to do. In our demo that goal returned a five-row table of fares. Our prompting guide has more patterns. One gotcha: a run marked "completed" only means the browser finished, so check the result for signs like "captcha", "blocked" or "access denied" before you trust it.

Step 7: Test it before you trust it

Write 20 real tasks with answers you've checked by hand, ideally the ones your first customers will actually ask. For each run, record:

  • Task success: did it meet your "done" checklist?
  • Accuracy: do the facts match the live source?
  • Steps and time: how many tool calls and seconds did it take?
  • Cost: model tokens plus web and browser usage.

Run the set every time you change the prompt, tools or model. Change one thing at a time. Most early gains come from better tool descriptions and clearer output instructions, not from switching models.

Step 8: Work out the cost per task

Agent costs come from two places:

CostHow it's pricedExample rate (Oct 2026)
ModelPer million input and output tokensClaude Opus 5.5: $4 input, $20 output
Search and fetchPer request or URLTinySearch and TinyFetch: free within limits
Browser agentPer stepTinyAgent: $0.016 per step
Remote browserPer minuteTinyBrowser: $0.002 per minute
MonitoringPer checkTinyMonitor: $0.005 per check

Multiply by your test set's average steps and tokens to get a cost per completed task, then compare it with what the task is worth to a customer. Prices are from Anthropic and TinyFish.

TinyFish for Startups covers a lot of this while you build. Tier 1 teams get free TinySearch and TinyFetch at 4x rate limits for 6 months, $100 in wallet credit every month and 50 concurrent TinyAgent and TinyBrowser runs. Tier 2 teams get 50% off TinyAgent and TinyBrowser for 24 months. See the tiers.

Step 9: Ship it safely

  • Start read-only. Let the agent search, read and summarise before you let it submit forms, send email or spend money.
  • Add a human approval step for anything irreversible.
  • Log every run: the goal, each tool call, the sources and the final answer. TinyAgent keeps screenshots and source URLs for every run, which helps when a customer asks why the agent said something.
  • Handle logins properly. If the agent needs to sign in to a site on a user's behalf, use saved browser profiles or a password-manager vault rather than putting passwords in prompts.
  • Respect the sites you use. Follow each site's terms, keep request rates reasonable, and don't collect personal data you don't need.

Mistakes founders make with their first agent

  • Too many tools on day one. Start with three. Add a tool only when your tests show the agent needs it.
  • No definition of done. Without a checklist you can't tell whether a change helped.
  • Trusting the model's memory for facts. Anything that changes, like prices, docs or availability, should come from the live web with a source.
  • Optimising cost before it works. Get the test set passing first, then lower model effort or switch to cheaper models where quality holds.
  • Building a browser stack from scratch. Proxies, anti-bot handling, retries and page cleaning are months of work that aren't your product.
Ready to build? Apply to TinyFish for Startups for free TinySearch and TinyFetch at 4x rate limits and up to $12,000 in value.

Keep reading

Follow TinyFish for new guides and startup builds: X (@Tiny_Fish) · LinkedIn · Discord

AI disclosure

Content on this website may be created or refined with the assistance of AI tools and is subject to human editorial review.

FAQ

Questions, answered.

What do I need to build an AI agent?

Can I build an AI agent without coding?

How much does it cost to run an AI agent?

How do AI agents access the internet?

Which model is best for building an agent?

How do I know if my agent is working?

Get started

Start building.

No credit card. No setup. Run your first operation in under a minute.

Get $8 in Wallet fundsRead the docs