@rs.tool, auto-infers the schema from the signature and docstring, and routes tool calls back to your app during sandbox execution.
Source: rayxc-org/raysurfer-python
Setup
Install the SDK and setRAYSURFER_API_KEY in your environment.
Register Tools
@rs.tool can wrap any Python function. The function signature is converted to schema fields, and the function docstring is used as the tool description in the tool payload.
How Functions Get Passed Back To The Agent
@rs.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:
