tool(...), and routes tool calls back to your app during sandbox execution.
Source: rayxc-org/raysurfer-ts
Setup
Install the SDK and setRAYSURFER_API_KEY in your environment.
Register Tools
tool(name, description, parameters, callback) can wrap any local callback you want to expose. The description is included in the tool payload.
How Functions Get Passed Back To The Agent
tool(...) registers two things locally in your app process:
- A tool schema (name, description, parameters) that Raysurfer sends to the sandbox run
- A callback function that stays local and is invoked when the sandbox requests that tool
execute()opens a callback session and sends tool schemas plus your task to Raysurfer.- Sandbox code calls a tool (for example
add(5, 3)). - Raysurfer sends a
tool_callmessage back to your app. - Your local callback runs, and the SDK sends
tool_resultback to the sandbox. - The sandbox continues running with that result.
Execute Modes
Use exactly one mode perexecute() call:
