Skip to content

Usage

All examples require TINYFISH_API_KEY set in your environment.


Agent API - Python

Stream a natural-language goal against a live website. The agent navigates, clicks, and extracts data autonomously.

python
from tinyfish import TinyFish, CompleteEvent

client = TinyFish()

with client.agent.stream(
    url="https://scrapeme.live/shop",
    goal="Extract the first 2 product names and prices. Return as JSON.",
) as stream:
    for event in stream:
        if isinstance(event, CompleteEvent):
            print(event.result_json)

Agent API - TypeScript

typescript
import { TinyFish } from "@tiny-fish/sdk";

const client = new TinyFish();

const stream = await client.agent.stream({
  url: "https://scrapeme.live/shop",
  goal: "Extract the first 2 product names and prices",
});

for await (const event of stream) {
  if (event.type === "COMPLETE") console.log(event.result);
}

CLI - Run an agent task

bash
tinyfish agent run "Extract the first 2 product names and prices" \
  --url https://scrapeme.live/shop --pretty

API Surfaces at a Glance

APITypical useCredits consumed
SearchFresh structured web results0 (free tier)
FetchRender any URL to markdown/JSON/HTML0 (free tier)
AgentMulti-step automation: fill forms, log in, extract1 credit per step
BrowserRaw stealth Chromium CDP session1 credit per 4 min

Browser Context Profiles

Browser context profiles persist logged-in state across agent runs. Create a profile once, reuse it for authenticated workflows without re-logging in on each run.


Cookbook

Real-world, runnable examples live in the open-source cookbook: https://github.com/tinyfish-io/tinyfish-cookbook