Installation
Setup
Set your API key:Usage
Swap your import — everything else stays the same:raysurfer, so you don’t need a
separate import:
How It Works
- On query: Retrieves cached code blocks matching your task
- Injects into prompt: Agent sees proven code snippets
- After success: New code is cached for next time
RAYSURFER_API_KEY is set. Without it,
behaves exactly like the original SDK.
Agent-Owned Repos
SetagentId to isolate uploads/searches into an agent-owned repo:
Agent-Accessible Functions
Decorator flow:raysurfer.yaml flow:
Class-based API
For users who prefer a class-based interface:RaysurferClient is also exported as an alias for ClaudeSDKClient —
use whichever name you prefer.System Prompt Preset
Use the Claude Code preset system prompt with appended instructions:Query Control Methods
Thequery() function returns a Query object with full control methods:
Snippet Retrieval Scope
Control which cached snippets are retrieved:Public Snippets
Include community public snippets (crawled from GitHub) alongside your private snippets:Low-Level API
For custom integrations, use theRaySurfer client directly:
Low-Level Client Options
Response Fields
Thesearch() response includes:
Each
CodeFile contains:
Search Response
Thesearch() method returns a SearchResponse:
Each
SearchMatch contains:
Method Reference
Programmatic Tool Calling
Also available as an integration guide: Register TypeScript Functions. Register local tools, then either passuserCode (primary mode) or use optional sandbox codegen with your own key + prompt:
tool() lets you wrap any local function as a tool callback.
The description string you pass is included in the tool schema payload.
How It Works
- SDK opens a live callback channel for tool call routing
- Your app sends either
userCode(primary mode) orcodegen(optional mode) to/api/execute/run - Code runs in a Modal sandbox — tool calls are routed back to your local functions through that callback channel
- Results are returned with full tool call history
userCode: run pre-generated code directly (recommended default)codegen: generate code in sandbox and run it
