Consistently chain together tool calls by helping your AI agents memorize execution-proven code.
Drop custom tools, go from 80% to 99% by only running code your agent generated that previously satisfied users.
Raysurfer surfaces the best code LLMs need, the moment they need it.
Inputs
LLM agents repeat the same patterns constantly. Raysurfer retrieves proven code and runs it with new inputs—no regeneration needed.
{
"user": "Update our Q3 revenue ($1.02B) in the quarterly report and sync it with the investor deck."
}I need to understand the task and find the relevant files.
Calling list_files("./reports/")...quarterly_report.xlsx, investor_deck.pptx, Q3_data.csvFound the files. Let me read the quarterly report first.
Calling read_file("quarterly_report.xlsx")...| Quarter | Revenue | Growth |
| Q3 2024 | $1.02B | +11% |Found Q3 revenue. Now I need to read the investor deck.
Calling read_file("investor_deck.pptx")...Slide 4: Q3 Financials - Revenue: $1.02B (+11% YoY)I also need to check the board presentation and analyst briefing.
Calling read_file("board_presentation.pptx")...Slide 12: Financial Summary - Q3 Revenue: $1.02B (+11% YoY)Found another file to update. Let me check the analyst briefing.
Calling read_file("analyst_briefing.docx")...Section 3: Q3 Performance - Revenue figure: $1.02B (+11% YoY)Need to also check the internal dashboard config.
Calling read_file("dashboard_config.json")...{ "q3_revenue": null, "last_updated": "2024-09-01" }Context limit approaching. Summarizing conversation...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Summary: User wants to update Q3 revenue ($1.02B) in
6 files: quarterly_report, investor_deck, board_presentation,
analyst_briefing, dashboard_config, and sync all references.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━I'll spawn subagents to update the Excel and PowerPoint files.
Calling spawn_subagents(["report", "deck", "board"])...┌─ Subagent A ──────────────────────────┐
│ Updating quarterly_report.xlsx... │
│ > LLM thinking... │
│ > Reading cell C4 │
│ > LLM thinking... │
│ > Writing $1.02B to C4 │
│ > LLM thinking... │
│ > Updating formulas in D4:F4 │
│ > LLM thinking... │
│ > Recalculating dependent cells │
│ > Formatting as currency │
│ ✓ Done │
└───────────────────────────────────────┘
┌─ Subagent B ──────────────────────────┐
│ Updating investor_deck.pptx... │
│ > LLM thinking... │
│ > Finding slide 4 │
│ > LLM thinking... │
│ > Locating revenue placeholder │
│ > LLM thinking... │
│ > Replacing with $1.02B │
│ > Updating chart data │
│ > Regenerating chart visuals │
│ ✓ Done │
└───────────────────────────────────────┘
┌─ Subagent C ──────────────────────────┐
│ Updating board_presentation.pptx... │
│ > LLM thinking... │
│ > Finding slide 12 │
│ > LLM thinking... │
│ > Locating financial summary │
│ > LLM thinking... │
│ > Replacing revenue figure │
│ > Updating executive summary │
│ ✓ Done │
└───────────────────────────────────────┘Subagents completed. Now I need to update the document files.
Checking results from first batch...✓ quarterly_report.xlsx: C4 = $1.02B, formulas updated
✓ investor_deck.pptx: Slide 4 updated with chart
✓ board_presentation.pptx: Slide 12 updatedFirst batch complete. Now spawning subagents for documents.
Calling spawn_subagents(["briefing", "config"])...┌─ Subagent D ──────────────────────────┐
│ Updating analyst_briefing.docx... │
│ > LLM thinking... │
│ > Parsing document structure │
│ > LLM thinking... │
│ > Finding Section 3 │
│ > LLM thinking... │
│ > Locating revenue placeholder │
│ > LLM thinking... │
│ > Replacing with $1.02B │
│ > Updating table of contents │
│ > Checking cross-references │
│ ✓ Done │
└───────────────────────────────────────┘
┌─ Subagent E ──────────────────────────┐
│ Updating dashboard_config.json... │
│ > LLM thinking... │
│ > Reading current config │
│ > LLM thinking... │
│ > Validating JSON schema │
│ > LLM thinking... │
│ > Updating q3_revenue field │
│ > LLM thinking... │
│ > Updating last_updated timestamp │
│ > Writing validated config │
│ ✓ Done │
└───────────────────────────────────────┘Second batch complete. Now I need to verify all changes.
Calling verify_all_files()...✓ analyst_briefing.docx: Section 3 updated
✓ dashboard_config.json: q3_revenue = 1.02BAll files updated. Now I need to sync the data warehouse.
Calling spawn_subagents(["warehouse", "cache"])...┌─ Subagent F ──────────────────────────┐
│ Syncing data warehouse... │
│ > LLM thinking... │
│ > Connecting to warehouse │
│ > LLM thinking... │
│ > Querying current Q3 records │
│ > LLM thinking... │
│ > Preparing update statement │
│ > LLM thinking... │
│ > Executing UPDATE query │
│ > LLM thinking... │
│ > Verifying row count │
│ > Committing transaction │
│ ✓ Done │
└───────────────────────────────────────┘
┌─ Subagent G ──────────────────────────┐
│ Invalidating cache entries... │
│ > LLM thinking... │
│ > Connecting to Redis │
│ > LLM thinking... │
│ > Finding Q3 revenue keys │
│ > LLM thinking... │
│ > Deleting stale cache entries │
│ > LLM thinking... │
│ > Pre-warming cache with new data │
│ > Verifying cache consistency │
│ ✓ Done │
└───────────────────────────────────────┘Context limit approaching. Summarizing progress...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Updated: quarterly_report, investor_deck, board_presentation,
analyst_briefing, dashboard_config, data warehouse, cache.
Remaining: notification system, audit log.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Need to notify stakeholders and update audit log.
Calling spawn_subagents(["notify", "audit"])...┌─ Subagent H ──────────────────────────┐
│ Sending stakeholder notifications... │
│ > LLM thinking... │
│ > Fetching stakeholder list │
│ > LLM thinking... │
│ > Composing email template │
│ > LLM thinking... │
│ > Personalizing for CFO │
│ > LLM thinking... │
│ > Personalizing for IR team │
│ > LLM thinking... │
│ > Sending via SendGrid │
│ > Verifying delivery status │
│ ✓ Done │
└───────────────────────────────────────┘
┌─ Subagent I ──────────────────────────┐
│ Updating audit log... │
│ > LLM thinking... │
│ > Creating audit entry │
│ > LLM thinking... │
│ > Recording file changes │
│ > LLM thinking... │
│ > Adding user attribution │
│ > LLM thinking... │
│ > Generating change hash │
│ > Writing to immutable log │
│ ✓ Done │
└───────────────────────────────────────┘All subagents completed. Let me run final verification.
Calling verify_all_systems()...✓ Warehouse: 1 row updated
✓ Cache: 3 keys invalidated, 3 pre-warmed
✓ Notifications: 5 emails sent
✓ Audit log: Entry #48291 createdRunning comprehensive verification across all systems.
Calling run_integration_tests()...Running 12 integration tests...
✓ File consistency check: PASSED
✓ Database integrity: PASSED
✓ Cache coherence: PASSEDAll tests passed. Generating comprehensive summary report.
Calling generate_summary()...Summary report generated: update_summary_2024Q3.pdfSummary generated. Finalizing and preparing response...Done! Updated Q3 revenue to $1.02B across 6 files,
synced warehouse, invalidated cache, notified 5 stakeholders,
and created audit log entry.{
"user": "Update our Q3 revenue ($1.02B) in the quarterly report and sync it with the investor deck."
}Understanding task: update Q3 revenue in report and deck.
Searching for cached solution...> Match: update_financials_and_sync.py
> Similarity: 0.96 | Verdict: +52 | Runs: 8,431> Running cached code with params:
revenue=$1.02B, files=[report, deck, board, briefing, config, warehouse]✓ Updated all 6 files and synced systems in 6sFor LLMs that generate code and execute it live-cache what works, skip what doesn't.
Code files generated by LLMs are cached. Retrieve and run proven code instead of regenerating.
Track which code executions succeeded or failed. Future agents retrieve successful code and avoid patterns that didn't work.
B2B vertical AI code is predictable. The same report generator, the same API client-perfect for caching and reuse.
.search() to retrieve cached snippets. .upload() to cache new ones.
Call .search() with a natural language query. Hybrid search finds the most relevant cached code from prior agent runs.
Call .upload() with the task, file, and result. Raysurfer indexes it with semantic embeddings for future retrieval.
Code that works gets thumbs up, code that fails gets thumbs down. Verdict-aware scoring improves retrieval over time.
from raysurfer import AsyncRaySurfer
rs = AsyncRaySurfer()
# Retrieve cached snippets
results = await rs.search("Update quarterly report")
# Cache new code after execution
await rs.upload(task, file, succeeded)Also available as a drop-in replacement for Claude Agent SDK that handles caching automatically via RaysurferClient.
Why are we all paying to regenerate the same tokens?
Every time your agent runs, you wait for tokens to generate. The same patterns. The same outputs. Every. Single. Time.
You're paying for tokens. You're waiting for generation. For code that's already been generated somewhere else.
Raysurfer retrieves and runs proven code from previous executions. No waiting. No regenerating. Just execute.
Stop watching your agent think. Get instant results from code that already works.
Perfect for long-running tasks: Dynamic code generation becomes trivial when your generated code is already context-managed. No more iteration loops. No more regeneration cycles. The code exists, it's been validated, it just needs to be executed.
“More tokens output causes a decrease in accuracy causes even more token output.”
Break the cycle. The median LLM agent activity for B2B SaaS is surprisingly low variance. Everything eventually viewed by a human is just HTML, PDF, or docs.
Track the user satisfaction rate of running different pieces of code
Estimate from the code and logs what user queries this code would best solve
.search() and .upload() — two calls, that's it
Free tier includes 500 API requests. No credit card required.