Skip to content

feat(tinyfish): add TinyFish web agent, search, and fetch integration - #7177

Merged
waleedlatif1 merged 3 commits into
stagingfrom
feat/tinyfish-integration
Aug 27, 2026
Merged

feat(tinyfish): add TinyFish web agent, search, and fetch integration#7177
waleedlatif1 merged 3 commits into
stagingfrom
feat/tinyfish-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Adds the TinyFish integration: 8 tools, a block, the brand icon, and hosted-key support. Built against TinyFish's published OpenAPI specs (agent/search/fetch), not prose docs — every request field, response mapping, and enum is traceable to a spec path.
  • Agent: tinyfish_run (sync), tinyfish_run_async, tinyfish_get_run, tinyfish_cancel_run, tinyfish_list_runs, tinyfish_list_vault_items. Search: tinyfish_search. Fetch: tinyfish_fetch.
  • Hosted key via TINYFISH_API_KEY_COUNT / TINYFISH_API_KEY_1..N, plus a tinyfish BYOK provider.

Hosted key and metering

  • Agent bills on the num_of_steps the API reports × $0.016/step. getCost throws rather than estimating if that field is missing.
  • Search and Fetch are free products, so they use per_request pricing at cost: 0. Fetch throttles on a urls dimension (40/min) because TinyFish's documented ceiling is 150 URLs/min, not requests/min.
  • tinyfish_run_async, get_run, cancel_run, list_runs, and list_vault_items deliberately declare no hosting. An async run's charge accrues after the request returns, so it can never be metered at call time. The block uses the established duplicate-apiKey split so those operations always show the key field.

Two gaps worth a reviewer's attention, both stated rather than papered over:

  1. A run that ends FAILED returns HTTP 200 with a step count, but the executor meters only successful executions — so TinyFish charges the hosted wallet for those steps and Sim bills nothing. Closing this needs a change to the executor's success gate, not to the pricing function. Documented in hosting.ts and pinned by a test.
  2. TinyFish's real Agent ceiling is 2 concurrent runs per account; the token bucket has no concurrency dimension, so requestsPerMinute: 5 is a proxy, not an equivalent. Also note the Search/Fetch ceilings are per account, so a key pool only adds headroom if each key is a separate TinyFish account.

Notable behavior

  • A failed automation is an HTTP 200 with the failure inside the run, so success comes from the run's own status. The structured error (code, category, retryAfter, helpUrl) is exposed as an output so a workflow can branch without parsing a message string.
  • goal and outputSchema are declared as request.modelInput — TinyFish hands the goal to the agent's LLM verbatim and re-prompts that model with the schema on a mismatch (schema_validation.re_prompt_attempts counts exactly those passes). The target URL, proxy settings, and vault scoping stay ordinary request inputs.
  • list_vault_items returns display-safe metadata only. It exists so the credential URIs credentialItemIds demands are discoverable in-product; secret values never leave TinyFish.
  • Fetch enforces the documented 1–10 URL bound locally so the failure names itself instead of surfacing a generic 400.
  • The icon is TinyFish's official mark, which they publish only as a raster — embedded as a base64 PNG in an SVG wrapper, the same pattern GoogleIcon already uses in that file.

Type of Change

  • New feature

Testing

  • 44 unit tests covering request-body construction, every response mapping, the FAILED-200 path, error-envelope extraction, model-input projection, hosted-key pricing and rate-limit dimensions, and block wiring. Verified they fail without their fixes.
  • bun run type-check, bun run lint, and all 36 check:audits gates pass, including docs:check, tool-metadata:check, integration-catalog:check, and check:api-validation:strict.
  • Validated with 3 parallel audit passes against the OpenAPI specs (wire correctness), block↔tool alignment, and hosted-key/provenance conventions; findings from all three are folded in.
  • Not exercised against a live TinyFish key — the account key is being added separately.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Adds the TinyFish integration: eight tools across the Agent, Search, and
Fetch APIs, a block wiring them, the brand icon, and hosted-key support.

Agent runs are metered on the step count TinyFish reports. Search and Fetch
are free, so their hosted key costs nothing to run. The async run and its
run read/cancel/list companions carry no hosting config — their charge
accrues after the request returns and cannot be metered — so they always
require the caller's own key.
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 27, 2026 10:21pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3 issues found across 29 files

Confidence score: 2/5

  • apps/sim/tools/tinyfish/hosting.ts checks URL-bucket usage only after dispatch, so a batch can exceed the available tokens when fewer URLs remain; reserve or compare the extracted URL count before execution.
  • apps/sim/tools/tinyfish/run.ts reports success: false for failed hosted-key runs after steps were consumed, causing executeTool to skip metering even though TinyFish charged the wallet; meter consumed usage independently of final success.
  • apps/sim/tools/tinyfish/run_async.ts does not add TinyFish-specific error details for non-2xx responses because executeRequest rejects before transformResponse; attach the TinyFish error envelope in the rejection path.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/tools/tinyfish/run_async.ts">

<violation number="1" location="apps/sim/tools/tinyfish/run_async.ts:48">
P2: For non-2xx responses, `executeRequest` rejects before this `transformResponse` branch runs, so async-run failures bypass `tinyfishErrorMessage` and its TinyFish-specific error details. Add the TinyFish envelope to the shared error extractor and remove this local HTTP-error branch so the production path surfaces consistent provider diagnostics.

(Based on your team's feedback about centralized tool errors.)</violation>
</file>

<file name="apps/sim/tools/tinyfish/hosting.ts">

<violation number="1" location="apps/sim/tools/tinyfish/hosting.ts:125">
P1: When the URL bucket has fewer tokens than a batch, this extractor cannot stop the request because usage is checked only after dispatch. Reserve or compare the extracted URL count before execution so a 10-URL batch cannot exceed the 40-URL/minute limit.</violation>
</file>

<file name="apps/sim/tools/tinyfish/run.ts">

<violation number="1" location="apps/sim/tools/tinyfish/run.ts:54">
P2: When a hosted-key run ends `FAILED` after consuming steps, this `success: false` result makes `executeTool` skip hosted-key metering, so Sim under-records usage despite TinyFish charging the wallet. Update the executor’s billing gate to meter terminal TinyFish runs independently of workflow success while keeping the failed result for callers.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/tools/tinyfish/hosting.ts
Comment thread apps/sim/tools/tinyfish/run_async.ts
Comment thread apps/sim/tools/tinyfish/run.ts
Comment thread apps/sim/tools/tinyfish/utils.ts Outdated
Comment thread apps/sim/blocks/blocks/tinyfish.ts Outdated
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a complete TinyFish integration spanning synchronous and asynchronous web-agent operations, search, fetch, vault metadata, hosted-key support, block configuration, documentation, and generated registries.

  • Adds eight TinyFish tools with normalized request and response contracts.
  • Registers TinyFish across workflow, BYOK, deployment, documentation, and icon surfaces.
  • Adds unit coverage for payload construction, response mapping, pricing, rate limiting, and block routing.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/tools/tinyfish/types.ts Defines typed TinyFish request, normalized output, and nullable raw wire contracts, completing the prior payload-typing fix.
apps/sim/tools/tinyfish/utils.ts Implements shared request construction, error extraction, parsing, model-input selection, and typed response normalization.
apps/sim/blocks/blocks/tinyfish.ts Exposes all TinyFish operations and their conditional inputs through one workflow block.
apps/sim/tools/tinyfish/tinyfish.test.ts Covers request bodies, response transforms, hosted-key behavior, bounds validation, and block routing.
apps/sim/tools/tinyfish/hosting.ts Configures hosted-key metering and rate limits for the synchronous agent, search, and fetch operations.
packages/deployment-config/src/integrations.json Registers TinyFish deployment configuration and hosted-key environment variables.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Block[TinyFish workflow block] --> Agent[Agent tools]
  Block --> Search[Search tool]
  Block --> Fetch[Fetch tool]
  Agent --> Sync[Run synchronously]
  Agent --> Async[Start and manage async runs]
  Agent --> Vault[List vault metadata]
  Sync --> Hosted[Hosted or user API key]
  Search --> Hosted
  Fetch --> Hosted
  Async --> BYOK[User API key]
  Vault --> BYOK
Loading

Reviews (3): Last reviewed commit: "chore(byok): audit that every hosted pro..." | Re-trigger Greptile

Comment thread apps/sim/tools/tinyfish/utils.ts Outdated
- Add tinyfish to PROVIDER_SECTIONS. The sectioned BYOK renderer drops any
  provider missing from a section, so the key field never rendered. Export
  PROVIDERS/PROVIDER_SECTIONS and assert they agree, so the next provider to
  miss a section fails CI instead of vanishing.
- Replace the `any` payload params with raw snake_case wire types. This caught
  two real gaps: `status` could reach the output undefined, and `error` could
  be null where ToolResponse.error is `string | undefined`.
- Reject an already-parsed array output schema, which a `json` block input can
  produce, and name malformed schema JSON instead of leaking a SyntaxError.
- Count Fetch rate-limit usage from the submitted URLs rather than the returned
  arrays, so a URL in neither array cannot undercount.
- Make "List runs" a literal canvas clause; a blank goal filter lists everything.
- Regenerate the docs manifest for the new integration page.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

Adds check:byok-providers. A hosted tool names its provider once in
hosting.byokProviderId, but the id must also reach the zod enum, the settings
PROVIDERS row, and a PROVIDER_SECTIONS section. Only the union is compiler-
enforced; the rest fail silently, which is how TinyFish shipped with no
settings row in the first place. Also flags drift between the two
BYOKProviderId declarations.

Correct the Search and Fetch rate-limit rationale: TinyFish documents both
ceilings per API key, not per account, so the numbered key pool does raise the
total. Records why a free product is still worth hosting — the endpoints
require a key, so hosting is what removes the signup.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 27, 2026 22:15
@waleedlatif1
waleedlatif1 merged commit 1465e94 into staging Aug 27, 2026
25 of 26 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/tinyfish-integration branch August 27, 2026 22:18
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