Installation
Setup
Set your API key:Usage
Swap your client class and method names. Options come directly fromclaude_agent_sdk:
Method Mapping
Options
Options are passed through directly fromclaude_agent_sdk.ClaudeAgentOptions. All standard options work:
RAYSURFER_API_KEY is set.
Agent-Owned Repos
Setagent_id to isolate uploads/searches into an agent-owned repo:
Agent-Accessible Functions
Decorator flow:raysurfer.yaml flow:
Snippet Retrieval Scope
Control which cached snippets are retrieved usingsnips_desired:
Public Snippets
Include community public snippets (crawled from GitHub) alongside your private snippets:Full Example
Without Caching
IfRAYSURFER_API_KEY is not set, RaysurferClient behaves exactly like ClaudeSDKClient — no caching, just a pass-through wrapper.
Low-Level API
For custom integrations, use theRaySurfer client directly.
Complete Low-Level Example with Anthropic API
Response Fields
Thesearch() response includes:
Each
CodeFile contains:
Async Version
Search Response
Thesearch() method returns a SearchResponse:
Each
SearchMatch contains:
Method Reference
Programmatic Tool Calling
Also available as an integration guide: Register Python Functions. Register local tools, then either passuser_code (primary mode) or use optional sandbox codegen with your own key + prompt:
@rs.tool decorator can wrap any Python function you want to expose as a tool.
It introspects the function signature to build a JSON schema.
Your function docstring becomes the tool description field in the tool schema payload.
Both sync and async callbacks are supported.
How It Works
- SDK opens a live callback channel for tool call routing
- Your app sends either
user_code(primary mode) orcodegen_*inputs (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
user_code: run pre-generated code directly (recommended default)codegen_api_key+codegen_prompt: generate code in sandbox and run it
