LLMs Technical Reviews

How is a tool call executed?

Proxy vs direct; sandboxing; rate limiting; retries; pagination; error mapping.

Verdict

Executor and ContextForge do the most work per call when you need governed execution you host yourself. Nango and Activepieces add a real job system. Most of the others are thin proxies with no retries.

Policy gateways. Executor applies policies ranked by owner. By default, POST, PUT, PATCH and DELETE need approval, and a run can pause and resume. It runs agent code in QuickJS with a 5-minute, 64 MB budget and fetch disabled. Rate limiting exists only in the cloud app. ContextForge checks RBAC and the input schema, closes the database session before network I/O, pins REST calls to the resolved IP against SSRF, and runs plugin pre/post hooks. ACI checks allowed apps, enabled functions and the linked account, plus an optional gpt-4o-mini instruction check. It then sends one httpx request with no retries, from a blocking client inside an async route.

Queued jobs. Nango queues actions in a Postgres orchestrator and runs them in node:vm on runner nodes, one per team in production. Its proxy retries and reads rate-limit headers. Activepieces workers poll the API over Socket.IO. The editor found that the isolate sandbox is used only in SANDBOX_* modes. The default is UNSANDBOXED.

Thin proxies. The Klavis router passes calls through with no retries, rate limits or timeout. It merges path, query and body params, so a duplicate key is overwritten. Metorial validates input with Zod, calls handleInvocation in-process and maps a 429 to upstream.rate_limited, but has no retries. merge-mcp retries every httpx.HTTPError, including 4xx, and returns the Python repr of a successful response (editor correction).

Hosted execution. Composio executes on its backend with retries switched off, because a tool call may not be idempotent. Custom tools run in your process. Its version pin applies only to manual tools.execute calls (editor correction). Pipedream runs components in its cloud. Retries are written per component, and the platform axios wrapper never retries but strips tokens from errors.

Pick: Executor or ContextForge for approval, RBAC and SSRF controls on a gateway you own. Pick: Nango or Activepieces when calls need queues, timeouts and retries. Pick: Klavis or merge-mcp only when a thin pass-through is enough.

Per-project answers

ComposioHQ/composio

answered

Tool execution is always proxied through the Composio backend — there is no local sandboxed execution in this repo. Execution happens via the Tools class (Python: python/composio/core/models/tools.py:135-831). Two paths exist: direct execution via tools.execute(slug, arguments, ...) which calls the Composio API's POST /tools/execute endpoint (Python: python/composio/core/models/tools.py:660-791), and session execution via session.execute(toolSlug, arguments) which routes through the Tool Router session's endpoint (Python: python/composio/core/models/tools.py:511-604). The session path resolves authentication and connection management automatically. Retries are intentionally disabled for both paths (Python: python/composio/core/models/tools.py:569-570) — tool execution is a non-idempotent write, and retrying after a timeout could duplicate side effects. Tool versioning is strict: execution requires a pinned version string (e.g., "20250909_00") or explicit dangerously_skip_version_check=True; calling with version "latest" raises a ToolVersionRequiredError (Python: python/composio/core/models/tools.py:636-637). The proxy mechanism (python/composio/core/models/tools.py:792-817) lets callers send raw HTTP requests to any toolkit's base URL, authenticated with the connected account's credentials. File handling is opt-in via dangerously_allow_auto_upload_download_files: when enabled, the SDK stages local files to S3 before execution and downloads result files afterward. Schema modifiers (before_execute, after_execute, before_file_upload) allow interposition on the execution pipeline. There is no rate limiting, pagination handling, or error mapping visible in the SDK itself — those are backend concerns.

Editor's note. Correction: the version pin only applies to manual tools.execute calls. Provider-wrapped calls force dangerouslySkipVersionCheck=true, and session executions skip the check entirely. Not all execution is remote either: custom tools (createCustomTool / experimental.tool) run in-process, and COMPOSIO_MULTI_EXECUTE_TOOL batches are split between local and backend execution.

activepieces/activepieces

answered

Tool call execution follows a Worker → Sandbox → Engine pipeline with sandboxed isolation.

Job dispatch: All execution starts in a BullMQ job queue. The API server enqueues jobs (e.g. WorkerJobType.EXECUTE_ACTION), and the worker picks them up via a polling loop. executeActionJob.ts handles individual action/tool calls: it resolves code steps (compiling user code into Deno/bundled JS artifacts via actionRunCache), resolves piece packages (fetching piece npm archives), provisions the sandbox with resolved pieces and code, then calls ctx.runtime.execute() (packages/server/worker/src/lib/execute/jobs/execute-action.ts:11-53).

Flow execution (executeFlowJob.ts) follows the same pattern: resolve the flow version → build an ExecuteFlowOperation (BEGIN or RESUME) → execute via sandbox runtime → report status to the API server (packages/server/worker/src/lib/execute/jobs/execute-flow.ts:12-125). The engine handles branch evaluation, step sequencing, AI model calls, and loop/approval gates internally.

Sandbox isolation uses the Linux isolate binary (from the IOI contest sandbox project), which creates a chroot-like environment with restricted filesystem mounts, process isolation, and resource limits (CPU time, memory, disk writes) (packages/server/sandbox/src/lib/sandbox/isolate.ts:1-80). The sandbox manager acquires a box, provisions caches (pieces + code), starts the engine node process, sends the operation via WebSocket (the AP_SANDBOX_WS_PORT/AP_SANDBOX_WS_TOKEN env vars), and returns the result. Timeout, memory overflow, and log-size-exceeded errors are detected and translated into structured error codes (TIMEOUT, MEMORY_LIMIT_EXCEEDED, LOG_SIZE_EXCEEDED) (packages/server/sandbox/src/lib/sandbox.ts:29-57, 66-80).

Retries and rate limiting: Actions can declare errorHandlingOptions.retryOnFailure (default false). BullMQ automatically retries INTERNAL_ERROR-terminated jobs (only if it's not the last attempt, !ctx.lastAttempt). MCP calls have per-call billing via mcpUsageTracker.resolveCallBilling(), which checks credit balance. The safeHttp.retryingAxios wrapper provides automatic retry with exponential backoff for HTTP requests (packages/server/worker/src/lib/execute/jobs/execute-flow.ts:91-97).

Error mapping: Engine statuses are mapped to run statuses — sandbox timeout → FlowRunStatus.TIMEOUT, memory issue → MEMORY_LIMIT_EXCEEDED, log overflow → LOG_SIZE_EXCEEDED, engine internal error → INTERNAL_ERROR, piece bundle not available → FAILED with a descriptive failedStep (packages/server/worker/src/lib/execute/jobs/execute-flow.ts:91-124).

Editor's note. Correction: the isolate sandbox is only used when AP_EXECUTION_MODE is SANDBOX_PROCESS or SANDBOX_CODE_AND_PROCESS; the default is UNSANDBOXED, where the engine runs as a plain Node child process (packages/server/sandbox/src/lib/create-sandbox-for-job.ts L48-L58). Workers also do not read BullMQ directly; they poll the API for jobs over a Socket.IO RPC channel.

NangoHQ/nango

answered

Tool calls execute through executeAction in action.service.ts which resolves the connection and function, then delegates to the orchestrator. The runner (packages/runner/lib/exec.ts) executes TypeScript in a sandboxed node:vm context — require() is restricted to only url, crypto, zod, botbuilder, soap, unzipper; console is a no-op proxy; codeGeneration disables strings and wasm. No container isolation is used. The proxy (proxy.service.ts:136-370) is the direct-execution path: it resolves the integration, loads/refreshes credentials, builds an InternalProxyConfiguration from the provider's proxy.base_url and headers template (interpolating ${apiKey}, ${connectionConfig.*}, etc.), then makes the HTTP request via axios. Rate limiting uses ratelimit.middleware.ts and a separate webhook ingress rate limiter. Plan-level capping is checked before every proxy request and webhook forward. Retries are configured per-request via the retries header, with maxWaitMs for backoff in the ProxyRequest class. Error mapping distinguishes upstream errors (returned as upstream_error with the provider's status) from infrastructure errors (ProxyServiceError with typed codes like base_url_override_disabled, connection_not_found, credentials_refresh_failed, plan_limit).

Editor's note. Correction: beyond node:vm, functions run on separate runner nodes managed by the fleet package (local child processes, Render, Kubernetes or Lambda), with one runner per team in production and a shared default runner otherwise.

PipedreamHQ/pipedream

answered

Proxy vs direct. Actions execute via the Pipedream cloud workflow engine — the open-source repository contains only the component definitions, not the runtime. Within a run() function, components call the external API using either the @pipedream/platform axios wrapper or a service-specific SDK (e.g. @octokit/core for GitHub, @slack/web-api for Slack, @googleapis/sheets for Google Sheets). The platform axios wrapper handles standard HTTP, OAuth1 signing, and error formatting; it injects auth from this.$auth but the cloud runtime resolves and populates that object before invoking the component.

Sandboxing and rate limiting. Sandboxing is handled by the cloud runtime (not in this repo). The platform/lib/axios.ts module converts Axios errors into structured summaries (status, statusText, headers, data) stripped of request config for safe exposure to users. Some components implement their own retry logic — e.g. Google Drive handles RETRYABLE_STATUS_CODES and RATE_LIMIT_ERROR_REASONS explicitly, and Slack uses async-retry.

Pagination. Pagination is handled per-component: the propDefinitions system supports cursor-based pagination via prevContext / nextPageToken patterns. Many action methods accept page/per_page parameters. The GitHub component uses @octokit/plugin-paginate-rest for REST API pagination and manual GraphQL cursor pagination.

Error mapping. The ConfigurationError from @pipedream/platform is used across components to surface configuration-level mistakes (e.g. missing permissions) to the user. Generic HTTP errors are returned as AxiosError summaries with context exported to the debug key.

Klavis-AI/klavis

answered

Layered proxy. Strata (tools.py:246-286): execute_action looks up MCPClient, merges params, calls client.call_tool(). MCPClient (mcp_proxy/client.py:97-122): session.call_tool() on MCP ClientSession; result.isError raises RuntimeError. Transport (mcp_client_manager.py:82-118): HTTPTransport or StdioTransport. Base (transport/base.py:32-56) uses AsyncExitStack. Direct client (mcp_client.py:331-386): find_server_for_tool(), 30s progress updates. Error mapping: exceptions caught/logged, returned as TextContent (tools.py:288-292). No sandboxing (process/container isolation). No rate limiting/retries. Sensitive params redacted (mcp_client.py:109-139). Pagination is server-specific.

aipotheosis-labs/aci

answered

Function execution is a multi-step pipeline triggered at POST /v1/functions/{function_name}/execute. The execute_function in functions.py (318-486) runs these stages: (1) Lookup — fetches the Function DB record by name. (2) Authorization chain — validates the app's AppConfiguration exists and is enabled, checks the function's app is in the agent's allowed_apps, verifies the function is in the enabled list, and confirms the LinkedAccount exists and is enabled (functions.py:364-433). (3) Credential resolution — calls security_credentials_manager.get_security_credentials which handles OAuth2 token expiry/refresh transparently (security_credentials_manager.py:33-49, 87-139). (4) Custom instruction validation — runs the function input against the agent's custom_instructions via GPT-4o (functions.py:451-456). (5) Execution — selects an executor via get_executor(function.protocol, linked_account) (function_executors/init.py:21-32). For REST protocol, RestFunctionExecutor._execute constructs an httpx request by combining the server_url, path, path params, query, header, cookie, and body from the function_input, then injects credentials and sends it (rest_function_executor.py:37-103). No sandboxing is applied — REST calls go directly to third-party APIs with a 10s/30s timeout. For the CONNECTOR protocol, ConnectorFunctionExecutor dynamically imports and instantiates a Python class from server/app_connectors/ (e.g., Gmail, E2B, Vercel) via importlib (connector_function_executor.py:31-61). BaseExecutor validates input against the JSON Schema and injects invisible default values before delegation (base_executor.py:32-82). Rate limiting is IP-based via RateLimitMiddleware (ratelimit.py:19-72) with per-second and per-day limits using a moving window. Daily/monthly quotas are enforced per project in validate_project_quota and validate_monthly_api_quota (dependencies.py:86-158). Results and errors are logged with structured telemetry to Logfire, including input/output truncation at 8KB (functions.py:239-273). There is no explicit retry or pagination mechanism in the executor — pagination is delegated to each API's own parameters.

Editor's note. Correction: the custom-instruction check defaults to gpt-4o-mini, not GPT-4o (custom_instructions.check_for_violation).

IBM/mcp-context-forge

answered

Tool calls are executed through a multi-phase pipeline in ToolService.invoke_tool().

Phase 0 – Request context: Sets the request_headers_var ContextVar for downstream session-affinity logic.

Phase 1 – Tool resolution: _resolve_tool_for_invocations() looks up the tool by name, checks RBAC, validates input schema against supplied arguments, and extracts tool/gateway payloads with auth, OAuth config, URL, and headers.

Phase 2 – Data extraction: All DB-backed data is extracted to local variables. The DB session is then committed and closed before any HTTP call — preventing connection-pool exhaustion during slow upstream requests.

OAuth token acquisition: For OAuth-protected tools, OAuthManager.get_access_token() obtains an access token via client_credentials, password, or token-exchange grant, with automatic decryption of stored credentials and up to max_retries with exponential backoff. Token exchange retry (_send_with_token_exchange_retry) handles 401-driven re-exchange-and-retry.

Plugin hooks: CPEX framework plugins intercept the call via TOOL_PRE_INVOKE hooks, modifying headers, arguments, or blocking execution.

SSRF protection: The target URL is validated by SecurityValidator.validate_url_for_connection_pinning() which resolves DNS, checks against blocked networks/hostnames, and pins the connection to the resolved IP. Localhost and private networks are blocked by default.

HTTP invocation: Depending on content type (JSON, form-data, multipart), httpx sends the request with connection pinning and timeout. The method defaults to POST (or the tool's request_type). Path/query parameter substitution and header/query mapping are applied before the call.

Direct proxy mode: For MCP-protocol upstreams, tools/call can be forwarded directly via the MCP SDK client session.

Rate limiting & retries: Configurable via retry_max_attempts (3), retry_base_delay with exponential backoff. Rate limiting is enforced at the middleware layer.

Error mapping: Tool errors map to specific exception types: ToolNotFoundError, ToolInvocationError, ToolTimeoutError, PluginViolationError. Observability spans track start/end, success/failure, and timing.

Sandboxing: There is no execution sandbox — tools proxy HTTP requests to upstream servers. SSRF protection and URL validation are the primary safety mechanisms.

UsefulSoftwareCo/executor

answered

A tool call is executed through a layered pipeline: code sandbox → tool invoker → plugin invoke → HTTP/transport.

Sandbox → executor → plugin: The ExecutionEngine (packages/core/execution/src/engine.ts) runs code inside a sandboxed runtime (QuickJS WASM, Deno subprocess, or Cloudflare dynamic worker). Code calling tools.<integration>.<owner>.<connection>.<tool>(args) is intercepted by makeFullInvoker() (line 342) which strips the tools. prefix and dispatches to executor.execute(). Inside makeExecutorToolInvoker() (tool-invoker.ts, line 314), the call is dispatched to the owning plugin via executor.execute(). Errors are caught: CredentialResolutionError → auth-failure tool result, ToolNotFoundError → tool_not_found, ToolBlockedError → tool_blocked, ElicitationDeclinedError → fail with clear message, and opaque defects → sanitized with a correlation ID (line 359).

OpenAPI invocation (packages/plugins/openapi/src/sdk/invoke.ts): invoke() (line 1198) builds an HTTP request via buildRequest() (line 960) which resolves path parameters, serializes query/header/cookie params per OAS3 style rules, applies auth headers, and constructs the request body (JSON, form-urlencoded, multipart, octet-stream via 26KB of encoding logic). The HTTP call uses HttpClient with two independent timeouts: RESPONSE_HEADERS_TIMEOUT_MS = 110_000 (line 202) and RESPONSE_BODY_TIMEOUT_MS = 60_000 (line 197). Streaming responses (NDJSON, SSE) are collected with byte and time caps (1MB/10s default). Transport failures are classified: DNS errors, connection refused, TLS failures get structured error fields (transportFailureFields, line 1185).

MCP invocation (packages/plugins/mcp/src/sdk/invoke.ts): calls the remote MCP server's tools/call over HTTP or stdio.

Pagination is not on the transport layer but on tool inventory: searchTools returns PagedResult<T> with items, total, hasMore, nextOffset (tool-invoker.ts, line 458). The paginate() helper (line 465) slices the result set.

Rate limiting: Not built into core. The cloud product adds it in apps/cloud/src/engine/execution-rate-limit.ts.

Retries: The engine caches settled outcomes for idempotent resume retries (settledOutcomes map, line 595, bounded to 64 entries). For MCP client retries of resume that arrive while the first is still in flight, a pendingResumes map (line 601) deduplicates concurrent resumes.

Approval gating: Tools annotated with requiresApproval trigger an elicitation before execution. The engine supports pause/resume via ElicitationHandler + Queue pattern (line 690).

metorial/metorial

answered

Tool calls dispatch via slates/action.tool.invoke handler. Looks up action, validates input against Zod schema, constructs SlateContext or SlatePublicContext, calls handleInvocation wrapped in traceProviderCall (packages/provider-handler/src/index.ts:939-1012).

Direct function dispatch, no sandbox. Rate limiting maps upstream 429 to upstream.rate_limited via mapServiceErrorCodeByStatus (packages/provider/src/error/service.ts:28-43). Error codes for request.rate_limited, upstream.rate_limited, upstream.timeout etc (packages/provider/src/error/defaults.ts:1-50).

No built-in retries. Pagination is integration-authored. Attachments collected, merged with auto-detected URL attachments, redacted via AuthConfigSecretRedactor, optionally directUploaded (packages/provider-handler/src/index.ts:48-164). Context via AsyncLocalStorage (packages/provider/src/context/hook.ts:15-20).

merge-api/merge-mcp

answered

Tool call execution is a synchronous request-reply proxy to the Merge API with no sandboxing. When the MCP server receives a tool call, ToolManager.call_tool (tool_manager.py:248-269) looks up the operation schema by operationId from the SchemaIndex, then calls _build_request_from_schema_and_arguments (tool_manager.py:208-246) which maps the MCP-provided arguments to the correct HTTP parameter locations: path parameters are interpolated into the URL (replacing {param} placeholders), query parameters are collected into query_params, and body parameters into body_params. Header parameters and parameters in the EXCLUDED_PARAMETERS list (include_deleted_data, include_remote_data, include_shell_data) are silently dropped (tool_manager.py:229-231). The actual HTTP request is made via MergeAPIClient._make_request (client.py:289-387) using httpx.AsyncClient with a configurable timeout (default 10s). The optional retry mechanism uses exponential backoff (delay *= 2) and is configurable per call (default 3 attempts, gated by with_retry flag) — tool calls use with_retry=True (tool_manager.py:265). HTTP errors (4xx/5xx) trigger retries on eligible status codes. Non-JSON responses are returned as raw text. There is no sandboxing, no rate limiting, no dedicated pagination support, and no request queueing — every tool call directly proxies to the Merge API and blocks until a response is received. Error responses are caught and returned as TextContent with descriptive messages including the request, schema, and arguments.

Editor's note. Correction: retries are not limited to eligible status codes. _make_request retries every httpx.HTTPError, including 4xx responses, with doubling backoff. Successful tool results are the Python repr of the response, not JSON.

← How are integrations exposed to LLM agents? · How are data sync, webhooks and triggers implemented? →