Skip to content

Add CrewAI TinyFish integration#16

Open
pranavjana wants to merge 2 commits into
mainfrom
pranav/crew-ai-sdk-tools
Open

Add CrewAI TinyFish integration#16
pranavjana wants to merge 2 commits into
mainfrom
pranav/crew-ai-sdk-tools

Conversation

@pranavjana
Copy link
Copy Markdown
Collaborator

Summary

  • add the CrewAI TinyFish package under crew-ai/
  • expose SDK-backed tools for web automation, queued runs, run lookup, run listing, search, fetch, and browser session creation
  • depend on tinyfish>=0.2.5 and remove stale batch/cancel tools from the public surface
  • add focused tests and scoped CI

Tests

  • make lint
  • make test
  • python3 -m build

Adds the CrewAI TinyFish package with SDK-backed tools for web automation, queued runs, run lookup, run listing, web search, content fetch, and browser session creation. Uses tinyfish>=0.2.5, includes focused tests, and adds scoped CI.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3b82b872-9fc0-42b1-abd2-c85b7a91bb9d

📥 Commits

Reviewing files that changed from the base of the PR and between 247ac38 and 9509c8d.

📒 Files selected for processing (5)
  • .github/workflows/crew-ai-ci.yml
  • crew-ai/pyproject.toml
  • crew-ai/requirements-dev.txt
  • crew-ai/src/tinyfish_web_agent/tool.py
  • crew-ai/tests/test_tool.py
✅ Files skipped from review due to trivial changes (2)
  • crew-ai/pyproject.toml
  • crew-ai/requirements-dev.txt
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/crew-ai-ci.yml
  • crew-ai/src/tinyfish_web_agent/tool.py
  • crew-ai/tests/test_tool.py

📝 Walkthrough

Walkthrough

This PR adds a production-ready CrewAI integration for TinyFish web automation. The implementation includes eight tool classes (synchronous/asynchronous run execution, run status queries, bulk run listing, web search, content fetching, and remote browser sessions) all backed by a shared base infrastructure that handles API key resolution, browser profile configuration, proxy setup, and standardized error handling. The module is fully tested with 13 test functions covering API contracts, SDK integration, and output formatting, and includes a GitHub Actions workflow enforcing linting and tests on changes to the crew-ai directory.

Sequence Diagram

sequenceDiagram
  participant Agent as CrewAI Agent
  participant Tool as TinyfishRun
  participant Base as _TinyfishBaseTool
  participant SDK as TinyFish SDK
  Agent->>Tool: _run(url, goal, profile)
  Tool->>Base: _get_client()
  Base->>Base: check TINYFISH_API_KEY
  Base->>SDK: __init__(api_key)
  SDK-->>Base: client instance
  Tool->>Base: _run_kwargs(profile)
  Base->>Base: resolve BrowserProfile
  Base->>Base: build proxy_config if needed
  Base-->>Tool: kwargs dict
  Tool->>Tool: _safe_call(client.agent.run, url, goal, **kwargs)
  Tool->>SDK: agent.run(...)
  SDK-->>Tool: RunResult(status, data, error)
  Tool->>Tool: format result as JSON or error string
  Tool-->>Agent: result string
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add CrewAI TinyFish integration' accurately and concisely summarizes the main change: adding a new CrewAI integration package for TinyFish with SDK-backed tools.
Description check ✅ Passed The description is directly related to the changeset, providing clear details about adding the CrewAI TinyFish package, exposed tools, dependencies, tests, and CI configuration—all of which are present in the changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pranav/crew-ai-sdk-tools

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/crew-ai-ci.yml (1)

35-39: ⚡ Quick win

CI is missing the package build smoke test listed in the PR test plan.

Add python -m build so packaging issues are caught before merge.

🔧 Proposed update
-      - run: python -m pip install -e . -r requirements-dev.txt
+      - run: python -m pip install -e . -r requirements-dev.txt build
@@
       - run: make test
+
+      - run: python -m build
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/crew-ai-ci.yml around lines 35 - 39, Add a packaging smoke
test to the CI steps by inserting a run step that executes "python -m build" (so
packaging errors fail the job) alongside the existing run steps that call
"python -m pip install -e . -r requirements-dev.txt", "make lint", and "make
test"; place the new "python -m build" run immediately after the pip install
step (or before make test) to ensure the project can be built before running
tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crew-ai/pyproject.toml`:
- Around line 6-9: The Python version constraint in requires-python is too low
for the tinyfish dependency; update the requires-python setting (the
requires-python = ">=3.10,<3.14" entry) to a range that includes Python 3.11
(for example raise the lower bound to >=3.11) so that tinyfish>=0.2.5 is
satisfiable; ensure the new upper bound still matches project compatibility
(e.g., ">=3.11,<3.14") and keep the dependency line "tinyfish>=0.2.5" unchanged.

In `@crew-ai/src/tinyfish_web_agent/tool.py`:
- Around line 118-121: The urls Field currently allows any list length but the
schema requires "one to ten URLs"; update the model to enforce this by using
pydantic constraints: either change the annotation to conlist(str, min_items=1,
max_items=10) and keep the Field description, or add min_items=1 and
max_items=10 to the existing Field(...) call for urls so the schema and runtime
validation match (refer to the urls Field definition to locate the change).
- Around line 425-427: The code currently reads runs via runs =
getattr(response, "runs", []) which breaks on tinyfish SDK v0.2.5+ where list
results are in response.data; update the handling in the function that calls
client.runs.list() (look for the variable response and the existing getattr
call) to first check for response.data (e.g., getattr(response, "data", None))
and fall back to response.runs for backward compatibility, and ensure the rest
of the logic uses that resolved list so the function no longer returns "No runs
found" incorrectly.
- Around line 232-236: The code constructs ProxyConfig with
ProxyCountryCode(self.proxy_country) inside _run_kwargs, which evaluates before
_safe_call and raises on invalid country codes; move the ProxyCountryCode
conversion into the try block inside _safe_call so invalid values are caught and
returned as a tool error. Specifically, in the method _run_kwargs, only set
kwargs["proxy_config"] with a placeholder or raw country string, and in the
_safe_call implementation (where exceptions are handled) perform
ProxyCountryCode(self.proxy_country) and then build ProxyConfig(enabled=True,
country_code=ProxyCountryCode(...)); ensure you validate against the allowed
codes (US, GB, CA, DE, FR, JP, AU) or catch ValueError from ProxyCountryCode and
return a controlled tool error instead of letting the exception propagate.

---

Nitpick comments:
In @.github/workflows/crew-ai-ci.yml:
- Around line 35-39: Add a packaging smoke test to the CI steps by inserting a
run step that executes "python -m build" (so packaging errors fail the job)
alongside the existing run steps that call "python -m pip install -e . -r
requirements-dev.txt", "make lint", and "make test"; place the new "python -m
build" run immediately after the pip install step (or before make test) to
ensure the project can be built before running tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 243e2ece-a73a-42a9-954e-9192b8b3f907

📥 Commits

Reviewing files that changed from the base of the PR and between 23f22da and 247ac38.

📒 Files selected for processing (9)
  • .github/workflows/crew-ai-ci.yml
  • crew-ai/.gitignore
  • crew-ai/Makefile
  • crew-ai/README.md
  • crew-ai/pyproject.toml
  • crew-ai/requirements-dev.txt
  • crew-ai/src/tinyfish_web_agent/__init__.py
  • crew-ai/src/tinyfish_web_agent/tool.py
  • crew-ai/tests/test_tool.py

Comment thread crew-ai/pyproject.toml Outdated
Comment thread crew-ai/src/tinyfish_web_agent/tool.py
Comment thread crew-ai/src/tinyfish_web_agent/tool.py Outdated
Comment thread crew-ai/src/tinyfish_web_agent/tool.py Outdated
Align Python requirements with TinyFish SDK, enforce fetch URL bounds, handle invalid proxy countries, support SDK data responses, and add CI build coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant