From 097f35f69fb896c7daf9d67efddaecaf61ec325a Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Fri, 12 Dec 2025 11:41:41 +1000 Subject: [PATCH] docs(sdk): add 'Passing API Keys' section with wrapper pattern --- apps/web/src/app/sdk/page.tsx | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/apps/web/src/app/sdk/page.tsx b/apps/web/src/app/sdk/page.tsx index 429d1e3..54031fe 100644 --- a/apps/web/src/app/sdk/page.tsx +++ b/apps/web/src/app/sdk/page.tsx @@ -453,6 +453,85 @@ export TPMJS_EXECUTOR_URL=https://executor.mycompany.com`} + {/* Passing API Keys */} +
+

Passing API Keys

+

+ Many tools require API keys (e.g., Firecrawl, Exa). The recommended approach is to + wrap registryExecuteTool with your + pre-configured keys. +

+ +
+ {/* Wrapper */} +
+

+ Create a Wrapper (Recommended) +

+ = { + FIRECRAWL_API_KEY: process.env.FIRECRAWL_API_KEY!, + EXA_API_KEY: process.env.EXA_API_KEY!, +}; + +// Create a wrapped version that auto-injects keys +export const registryExecute = tool({ + description: registryExecuteTool.description, + parameters: registryExecuteTool.parameters, + execute: async ({ toolId, params }) => { + return registryExecuteTool.execute({ toolId, params, env: API_KEYS }); + }, +});`} + /> +
+ + {/* Usage */} +
+

Use the Wrapped Tool

+ +
+ + {/* How it works */} +
+

How It Works

+
    +
  1. + registrySearch returns{' '} + requiredEnvVars for each tool (e.g.,{' '} + ["FIRECRAWL_API_KEY"]) +
  2. +
  3. Your wrapper automatically passes all configured keys to the executor
  4. +
  5. + The executor injects matching keys as environment variables in the sandbox +
  6. +
  7. Tools without required keys work with or without the wrapper
  8. +
+
+
+
+ {/* Security */}

Security