Skip to main content
This page documents all publicly exposed functions and types in the Raysurfer SDK. Every type is defined down to primitive fields.

High-Level Client

RaysurferClient

Drop-in replacement for Claude Agent SDK’s ClaudeSDKClient.

Constructor Parameters

PythonRaysurferClient(options, workspace_id=None, debug=False): TypeScriptnew RaysurferClient(options) where options is a single object:

Methods


Low-Level API Client

RaySurfer / AsyncRaySurfer

Constructor Options


Search for cached code snippets by task description.

Parameters

Returns: SearchResponse

Queries can be any length, but shorter queries (under 200 characters) give the best accuracy and speed. Longer queries are automatically rephrased into multiple shorter searches and merged, which adds latency and may reduce precision.
LLM prompt augmentation: The legacy convenience method get_code_files() / getCodeFiles() wraps search() and returns an add_to_llm_prompt string. Use search() directly for full control over results.

upload

Upload a code file from an execution for future reuse.

Parameters

Returns: SubmitExecutionResultResponse

When use_raysurfer_ai_voting is true (the default) and no user_vote is provided, each newly stored code block is automatically evaluated by Raysurfer’s AI. If you provide a user_vote, AI voting is skipped entirely — your vote is applied directly.

upload_bulk_code_snips / uploadBulkCodeSnips

Bulk upload prompts, logs, and code files for sandboxed grading.

Parameters

Returns: BulkExecutionResultResponse


delete

Delete a snippet and all its associated data (vectors, retrieval logs, votes).

Parameters

Returns: DeleteResponse


vote_code_snip / voteCodeSnip

Vote on whether a cached code snippet was useful. This triggers background voting on the backend.

Returns: VoteCodeSnipResponse

Voting is triggered automatically by upload when use_raysurfer_ai_voting is true (the default), and also by the high-level RaysurferClient. Use vote_code_snip directly only for voting on cached blocks after reuse.

Response Types

SearchResponse

Returned by search().

SubmitExecutionResultResponse

Returned by upload().

BulkExecutionResultResponse

Returned by upload_bulk_code_snips().

DeleteResponse

Returned by delete().

VoteCodeSnipResponse

Returned by vote_code_snip().

Data Types

SearchMatch

A single result from search(). Contains a full CodeBlock plus a relevance score.

FunctionReputation

Per-function reputation metadata returned on SearchMatch.functions.

CodeBlock

A stored code block with full metadata. Nested inside SearchMatch.

Input Types

FileWritten

A file created during agent execution. Used by upload() and upload_bulk_code_snips().

LogFile

A log file for bulk grading. Used by upload_bulk_code_snips().

Enums

ExecutionState

Technical execution outcome.

AgentVerdict

Agent’s judgment on execution quality.

SnipsDesired

Scope of private snippets for retrieval.

Exceptions

Both SDKs include built-in retry logic with exponential backoff for transient failures (429, 5xx, network errors). You don’t need to implement your own retry logic for these cases.

RaySurferError

Base exception for all Raysurfer errors.

APIError

Raised when the API returns an error response. Extends RaySurferError.

AuthenticationError

Raised when the API key is invalid or missing. Extends RaySurferError.

CacheUnavailableError

Raised when the cache backend is unreachable or returns an unexpected error. Extends RaySurferError.

RateLimitError

Raised when the API rate limit is exceeded. The SDK automatically retries with exponential backoff before raising this error. Extends RaySurferError.

ValidationError

Raised when request validation fails. Extends RaySurferError.