Skip to main content

Installation

Setup

Set your API key:
Get your key from the dashboard.

Usage

Swap your client class and method names. Options come directly from claude_agent_sdk:

Method Mapping

Options

Options are passed through directly from claude_agent_sdk.ClaudeAgentOptions. All standard options work:
Caching is enabled automatically when RAYSURFER_API_KEY is set.

Agent-Owned Repos

Set agent_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 using snips_desired:

Public Snippets

Include community public snippets (crawled from GitHub) alongside your private snippets:
See How It Works — Public Snippets for details.

Full Example

Without Caching

If RAYSURFER_API_KEY is not set, RaysurferClient behaves exactly like ClaudeSDKClient — no caching, just a pass-through wrapper.

Low-Level API

For custom integrations, use the RaySurfer client directly.

Complete Low-Level Example with Anthropic API

Response Fields

The search() response includes: Each CodeFile contains:

Async Version

Search Response

The search() 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 pass user_code (primary mode) or use optional sandbox codegen with your own key + prompt:
The @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

  1. SDK opens a live callback channel for tool call routing
  2. Your app sends either user_code (primary mode) or codegen_* inputs (optional mode) to /api/execute/run
  3. Code runs in a Modal sandbox — tool calls are routed back to your local functions through that callback channel
  4. Results are returned with full tool call history
Use exactly one mode per call:
  • user_code: run pre-generated code directly (recommended default)
  • codegen_api_key + codegen_prompt: generate code in sandbox and run it

Execute Options

ExecuteResult Fields