Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/crew-ai-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CrewAI CI

on:
pull_request:
branches: [main]
paths:
- ".github/workflows/crew-ai-ci.yml"
- "crew-ai/**"
push:
branches: [main]
paths:
- ".github/workflows/crew-ai-ci.yml"
- "crew-ai/**"

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: crew-ai

steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: "3.12"

- run: python -m pip install --upgrade pip

- run: python -m pip install -e . -r requirements-dev.txt

- run: make lint

- run: make test

- run: python -m build
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
.claude/
google-adk/
langchain/
supabase/
zapier/
test_tinyfish_crew/
crew-ai/examples/
19 changes: 19 additions & 0 deletions crew-ai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# Virtual environments
.venv

# Lockfiles
uv.lock

# Environment variables
.env

# Claude Code
.claude/
15 changes: 15 additions & 0 deletions crew-ai/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: format lint test clean

format:
ruff format src tests
ruff check --fix src tests

lint:
ruff check src tests

test:
pytest tests -v

clean:
rm -rf build dist *.egg-info .pytest_cache .ruff_cache
find . -type d -name __pycache__ -exec rm -rf {} +
142 changes: 142 additions & 0 deletions crew-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Tinyfish — CrewAI Tool

Automate any website using natural language with [TinyFish Web Agent](https://tinyfish.ai). Extract data, fill forms, click buttons, navigate pages, and more — all described in plain English.

## Installation

Clone the repo and install the tool locally:

```bash
git clone https://github.com/tinyfish-io/tinyfish-web-agent-integrations.git
cd tinyfish-web-agent-integrations/crew-ai
pip install -e .
```

## Setup

Get your API key at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys), then set it as an environment variable:

```bash
export TINYFISH_API_KEY="your-api-key"
```

Or add it to your `.env` file:

```dotenv
TINYFISH_API_KEY=your-api-key
```

`tinyfish-web-agent` automatically tags TinyFish SDK requests as originating
from `crew-ai`. You do not need to set `TF_API_INTEGRATION` yourself.

## Tools

| Tool | Description |
|------|-------------|
| `TinyfishRun` | Run a browser automation synchronously. Best for quick tasks (<30s). |
| `TinyfishRunAsync` | Start an automation asynchronously. Returns a `run_id` immediately. |
| `TinyfishGetRun` | Check status and get results of a run by its `run_id`. |
| `TinyfishListRuns` | List recent automation runs, optionally filtered by status. |
| `TinyfishSearch` | Search the web and return structured results. |
| `TinyfishFetch` | Fetch clean content from one or more URLs. |
| `TinyfishBrowserSession` | Create a remote browser session and return connection URLs. |

`Tinyfish` is an alias for `TinyfishRun`.

## Usage

### Basic — synchronous run

```python
from crewai import Agent
from tinyfish_web_agent import TinyfishRun

agent = Agent(
role="Web Researcher",
goal="Find and extract information from websites",
tools=[TinyfishRun()],
)
```

### Async workflow — start and check

```python
from tinyfish_web_agent import TinyfishRunAsync, TinyfishGetRun

agent = Agent(
role="Data Collector",
goal="Collect data from multiple sources efficiently",
tools=[TinyfishRunAsync(), TinyfishGetRun()],
)
```

### Search and fetch

```python
from tinyfish_web_agent import TinyfishSearch, TinyfishFetch

agent = Agent(
role="Web Researcher",
goal="Search the web and read relevant pages",
tools=[TinyfishSearch(), TinyfishFetch()],
)
```

### All tools at once

```python
from tinyfish_web_agent import (
TinyfishRun,
TinyfishRunAsync,
TinyfishGetRun,
TinyfishListRuns,
TinyfishSearch,
TinyfishFetch,
TinyfishBrowserSession,
)

agent = Agent(
role="Web Automation Specialist",
goal="Automate any web task",
tools=[
TinyfishRun(),
TinyfishRunAsync(),
TinyfishGetRun(),
TinyfishListRuns(),
TinyfishSearch(),
TinyfishFetch(),
TinyfishBrowserSession(),
],
)
```

## Configuration

All tools accept these optional constructor parameters:

| Parameter | Description |
|-----------|-------------|
| `api_key` | TinyFish API key. Falls back to `TINYFISH_API_KEY` env var. |
| `proxy_country` | Route through a proxy in this country (`US`, `GB`, `CA`, `DE`, `FR`, `JP`, `AU`). |

The package also sets `TF_API_INTEGRATION=crew-ai` internally so requests are
attributed automatically.

```python
tool = TinyfishRun(api_key="sk-...", proxy_country="US")
```

## Example goals

```text
"Extract all product names, prices, and ratings from this page"
"Fill the contact form with name 'Jane Doe' and email 'jane@example.com', then submit"
"Click 'Next Page' 3 times, extracting all listings from each page"
"Log in with the provided credentials, then extract the dashboard data"
```

## Support

- [TinyFish Docs](https://docs.tinyfish.ai)
- [CrewAI Docs](https://docs.crewai.com)
- [Discord](https://discord.gg/agentql)
27 changes: 27 additions & 0 deletions crew-ai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "tinyfish-web-agent"
version = "0.2.0"
description = "Power up your crews with TinyFish Web Agent"
readme = "README.md"
requires-python = ">=3.10,<3.14"
dependencies = [
"crewai[tools]>=0.203.1",
"requests>=2.28",
]

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]

[tool.crewai]
type = "tool"

[tool.ruff]
target-version = "py310"
line-length = 88

[tool.ruff.lint]
select = ["E", "F", "I", "T201", "W"]
3 changes: 3 additions & 0 deletions crew-ai/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build>=1.0,<2.0
pytest>=7.0,<9.0
ruff>=0.4,<1.0
3 changes: 3 additions & 0 deletions crew-ai/src/tinyfish_web_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .tool import TinyfishWebAgent

__all__ = ["TinyfishWebAgent"]
Loading