Skip to main content

Drop-in replacement for Claude Agent SDK with automatic code caching - just swap your import

Project description

RaySurfer Python SDK

Drop-in replacement for Claude Agent SDK with automatic code caching. Same API, 20-30x faster.

Install

pip install raysurfer

Quick Start

Swap ClaudeSDKClient for RaysurferClient - everything else stays the same:

# from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
from raysurfer import RaysurferClient, RaysurferAgentOptions

options = RaysurferAgentOptions(
    raysurfer_api_key="your-api-key",
    allowed_tools=["Read", "Write", "Bash"],
    model="claude-sonnet-4-20250514",
)

# async with ClaudeSDKClient(options) as client:
async with RaysurferClient(options) as client:
    await client.query("Generate quarterly sales report")
    async for msg in client.receive_response():
        print(msg)

That's it. Your agent now automatically:

  • Pre-fetches relevant cached code before each task
  • Injects proven code snippets into the system prompt
  • Stores successful outputs for future reuse

How It Works

  1. On query(): Retrieves cached code blocks matching your task
  2. Downloads to sandbox: Files ready for the agent to execute
  3. Injects into prompt: Agent sees proven code snippets
  4. After success: New code is cached for next time

Measured Results:

  • Without RaySurfer: 34.2s, 11 iterations, 2 tool calls
  • With RaySurfer: 1.4s, 1 iteration, 0 tool calls
  • Speedup: 24x faster

RaysurferAgentOptions

All ClaudeAgentOptions fields are supported, plus:

RaysurferAgentOptions(
    # Raysurfer-specific
    raysurfer_api_key="your-api-key",
    prefetch_count=5,           # Code files to pre-fetch
    min_verdict_score=0.3,      # Quality threshold

    # Standard Claude Agent SDK options
    allowed_tools=["Read", "Write", "Bash"],
    model="claude-sonnet-4-20250514",
    system_prompt="You are helpful.",
    permission_mode="acceptEdits",
    # ... all other ClaudeAgentOptions
)

Snippet Retrieval Scope

Control which snippets are retrieved using public_snips and snips_desired:

from raysurfer import RaysurferClient

# Include both public and company snippets
client = RaysurferClient(
    options=options,
    public_snips=True,       # Include public/shared snippets
    snips_desired="company", # Also include company-level snippets (Team/Enterprise)
)

# Enterprise: Retrieve client-specific snippets only
client = RaysurferClient(
    options=options,
    snips_desired="client",  # Client workspace snippets (Enterprise only)
)
Configuration Required Tier
public_snips=True only FREE (default)
snips_desired="company" TEAM or ENTERPRISE
snips_desired="client" ENTERPRISE only

Low-Level API

For direct code block storage and retrieval:

from raysurfer import RaySurfer

rs = RaySurfer(api_key="your-api-key")

# Store a code block
rs.store_code_block(
    name="fetch_weather",
    source="def fetch_weather(city): ...",
    entrypoint="fetch_weather",
    language="python",
)

# Retrieve by task
results = rs.retrieve("get weather data")
for match in results.code_blocks:
    print(f"{match.code_block.name}: {match.score}")

Verdict System

RaySurfer learns which code actually works through thumbs up/down verdicts:

  • A technical error can be thumbs up (correct validation)
  • A successful run can be thumbs down (useless output)

The system learns usefulness, not just whether code runs.

Examples

See examples/ for complete demos.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raysurfer-0.4.2.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raysurfer-0.4.2-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file raysurfer-0.4.2.tar.gz.

File metadata

  • Download URL: raysurfer-0.4.2.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for raysurfer-0.4.2.tar.gz
Algorithm Hash digest
SHA256 714bf1dbe5a7996d105b7981c60ce12f380a77b0556af7e78d19243b67539490
MD5 de25742b3d83debe29d3350fbfcca1af
BLAKE2b-256 d60c1b57d2980a8674fe114c99f05aaeeac2edfe06979554325e9c83b705e0a5

See more details on using hashes here.

File details

Details for the file raysurfer-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: raysurfer-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for raysurfer-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dcddd5c76dbc500cdafd75c42f57618aefcd2913641b98d0bdcab3d71e6d997c
MD5 ccc96c551889969ff2ddb757f0ae803f
BLAKE2b-256 3bb0ea9da58363486ef39f0325f1898128f8353ee7c0149f2d38e33cf95f6e87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page