sim icon indicating copy to clipboard operation
sim copied to clipboard

feat(exa): add x-exa-integration header for usage attribution

Open tgonzalezc5 opened this issue 7 months ago • 3 comments

Summary

Adds an x-exa-integration: sim header to every request the Exa tools send to api.exa.ai. This is a request header Exa uses on their side to attribute API traffic to the integration that originated it; it has no effect on the response or on user-facing behavior.

Updated:

  • apps/sim/tools/exa/search.ts
  • apps/sim/tools/exa/get_contents.ts
  • apps/sim/tools/exa/find_similar_links.ts
  • apps/sim/tools/exa/answer.ts
  • apps/sim/tools/exa/research.ts (both the create-task POST and the polling GET)

Example

headers: (params) => ({
  'Content-Type': 'application/json',
  'x-api-key': params.apiKey,
  'x-exa-integration': 'sim',
}),

Test plan

  • [x] grep -n "x-exa-integration" apps/sim/tools/exa/*.ts shows the header set in all 6 request sites (5 tools, plus the research polling fetch)
  • [ ] Existing Exa tool tests still pass (no behavioral change to params/response handling)

tgonzalezc5 avatar May 01 '26 21:05 tgonzalezc5

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 1, 2026 9:07pm

Request Review

vercel[bot] avatar May 01 '26 21:05 vercel[bot]

PR Summary

Low Risk Low risk: this only adds a static request header to Exa API calls and does not change request bodies or response handling; the main risk is if Exa rejects unknown headers, which is unlikely.

Overview Adds the x-exa-integration: sim header to all Exa tool HTTP requests (search, answer, get_contents, find_similar_links, and research, including the research polling GET) so Exa can attribute API usage to this integration.

Reviewed by Cursor Bugbot for commit 39c92869b443cca21762f06cc5884866582ccaaf. Bugbot is set up for automated code reviews on this repo. Configure here.

cursor[bot] avatar May 01 '26 21:05 cursor[bot]

Greptile Summary

This PR adds 'x-exa-integration': 'sim' as a static attribution header to all outbound requests made by the five Exa tools (search, answer, get_contents, find_similar_links, research). The header is purely informational on Exa's side and has no effect on request/response semantics. Coverage is complete — the research tool correctly adds it to both the initial task-creation POST and the polling GET inside postProcess.

Confidence Score: 5/5

Safe to merge — additive-only change with no behavioral impact on request/response handling.

All five tool files are updated consistently and the header value is a hardcoded, non-sensitive string. The research polling path is also covered. No logic, type, or security concerns.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/tools/exa/search.ts Adds x-exa-integration: sim header to the search tool's request headers — correct and complete.
apps/sim/tools/exa/answer.ts Adds x-exa-integration: sim header to the answer tool's request headers — correct and complete.
apps/sim/tools/exa/find_similar_links.ts Adds x-exa-integration: sim header to the find-similar-links tool's request headers — correct and complete.
apps/sim/tools/exa/get_contents.ts Adds x-exa-integration: sim header to the get-contents tool's request headers — correct and complete.
apps/sim/tools/exa/research.ts Adds x-exa-integration: sim to both the task-creation POST (via headers config) and the polling GET inside postProcess — both call sites correctly covered.

Sequence Diagram

sequenceDiagram
    participant Client as Sim Workflow
    participant Tool as Exa Tool
    participant Exa as api.exa.ai

    Client->>Tool: execute(params)
    Tool->>Exa: POST /endpoint (x-exa-integration: sim added)
    Exa-->>Tool: response
    alt research tool polling
        loop until complete
            Tool->>Exa: GET /research/v1/taskId (x-exa-integration: sim added)
            Exa-->>Tool: task status
        end
    end
    Tool-->>Client: processed result

Reviews (1): Last reviewed commit: "feat(exa): add x-exa-integration header ..." | Re-trigger Greptile

greptile-apps avatar May 01 '26 21:05 greptile-apps