Skip to content

Remote Tool Calling

Remote Tool Calling (RTC) is the core protocol of RTC Agent. It reverses the traditional invocation direction: instead of the frontend calling backend APIs, AI calls frontend tools — file read/write, script execution, and business API calls all happen within the user’s browser.

TraditionalRTC
Tool ExecutionServerFrontend
Data FlowTo the cloud 🔒Stays on user’s device 🔐
PrivacyData passes through serverEnd-to-end, data never leaves the browser
ObservabilityBlack boxFully visible to the user

A single RTC call goes through the following steps:

💡 Key Design: After pushing the RTC, the server suspends the Turn and saves a Checkpoint to Redis. Even if the server restarts, it can recover from the Checkpoint — the user is completely unaware.

The RTC protocol defines 6 built-in tools covering file system operations and script execution:

ToolFunctionKey Parameters
🔍 lsList directory contentspath (default /)
📖 readRead file contentspath, offset / limit (pagination)
✏️ writeWrite to filepath, content, mode (overwrite / append)
🔎 grepSearch by contentpattern (regex), path
📁 findSearch by namepattern (glob), path
scriptExecute JavaScriptaction (save / run / eval), code

These 6 tools give the AI a complete file operation interface — operating on the frontend virtual file system just like working with a local terminal.

Each RTC call has a well-defined lifecycle state:

StatePrompt Seen by AIDescription
Pending[Tool Pending]Waiting for frontend to receive
Sent[Tool Pending]Delivered to frontend
Executing[Tool Pending]Currently executing
CompletedTool outputExecution successful, result returned
Failed[Tool Error]Execution failed
Timeout[Tool Timeout]Execution timed out
Rejected[Tool Rejected]User rejected execution

Different work modes determine whether tool execution requires user confirmation. See Work Modes for the full permission matrix.

📌 Core Principle: Read-only operations are always safely allowed; write only requires confirmation in the highest-alertness mode; script can execute arbitrary code, so it requires user confirmation in all modes except bypass.

The core reliability guarantee of RTC is the Checkpoint:

FeatureDescription
Storage LocationRedis, TTL 24 hours
Crash RecoveryCan recover from Checkpoint after server restart
User ExperiencePerceived as “AI waiting for tool result before continuing”

RTC result reporting follows the 100% delivery principle:

Why must it be 100% delivered? Because the AI is waiting for the tool result to continue reasoning. If the result is lost, the AI will wait indefinitely.

MechanismDescription
Infinite RetryFailed submissions are automatically retried, with no give-up mechanism
Idempotency GuaranteeRepeated submissions with the same client_id return success
Exponential BackoffRetry intervals: 1s → 2s → 4s → … → capped at 30s

RTC calls within the same session are strictly serialized to avoid file conflicts caused by concurrency:

The next RTC is processed only after the current one completes. This is transparent to the user — the AI naturally completes each operation in sequence.