Skip to main content
1

Create a TinyFish account

Sign up for a new TinyFish account here.
2

Get your API key

  1. Go to the API Keys page
  2. Click “Create API Key”
  3. Copy and store your key securely in your shell environment
API keys are shown only once. Store them securely and never commit them to version control.
export TINYFISH_API_KEY=sk-tinyfish-*****
3

Write code for your first workflow

We’ll write the minimal code to navigate to a website and extract product data using natural language.
# first_automation.py
from tinyfish import TinyFish, CompleteEvent

client = TinyFish()  # Reads TINYFISH_API_KEY from environment

# Stream the automation and print the structured result
with client.agent.stream(
    url="https://scrapeme.live/shop",  # Target website to automate
    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)
See our Prompting Guide to get structured JSON responses instead of plain text.
4

Run your first workflow

Run the code with the following command:
python first_automation.py
5

Verify output

You should see SSE events streaming in your terminal:
{'type': 'STARTED', 'run_id': 'abc123'}
{'type': 'STREAMING_URL', 'run_id': 'abc123', 'streaming_url': 'https://tf-abc123.fra0-tinyfish.unikraft.app/stream/0'}
{'type': 'PROGRESS', 'run_id': 'abc123', 'purpose': 'Visit the page to extract product information'}
{'type': 'PROGRESS', 'run_id': 'abc123', 'purpose': 'Check for product information on the page'}
{'type': 'COMPLETE', 'run_id': 'abc123', 'status': 'COMPLETED', 'result': {
  "products": [
    { "name": "Bulbasaur", "price": "$63.00" },
    { "name": "Ivysaur", "price": "$87.00" },
  ]
}}
With --pretty, the CLI output looks like:
▶ Run started
• Visit the page to extract product information
• Check for product information on the page
✓ Completed

{"products": [{"name": "Bulbasaur", "price": "$63.00"}, {"name": "Ivysaur", "price": "$87.00"}]}

View run: https://agent.tinyfish.ai/runs/abc123

Next Steps

Agent API Reference

Streaming, async runs, and endpoint selection

Examples

Copy-paste ready code