Skip to main content

Agent-Owned Repos

What This Means

An agent-owned repo is the idea that agents can build up a library of proven code over time, based on execution results rather than one-off code generation. Instead of generating from scratch every run, agents:
  1. Search for proven code that already solved similar tasks
  2. Execute the code in an isolated sandbox environment
  3. Score the results — AI automatically evaluates code quality and promotes what works
  4. Build a library — over time, the agent accumulates a growing collection of reliable code

Quick Start

Pass your chat history as Anthropic-typed messages. The agent handles caching, code reuse, and quality scoring automatically.
from raysurfer import Agent

agent = Agent()
result = await agent.run(
    org_id="acme-corp",
    user_id="user_123",
    messages=[
        {"role": "user", "content": "Generate a quarterly report from our sales data"},
    ],
)

How Code Quality Improves Over Time

Every time agent.run() processes a conversation, it tracks which cached code snippets were retrieved and used. AI automatically evaluates execution results and votes on all the code that contributed:
  • Successful execution → thumbs up on every cached snippet used → those snippets rank higher in future searches
  • Failed execution → thumbs down → those snippets get demoted and eventually stop surfacing
This creates a closed loop: execution quality directly determines which code gets reused. Code that consistently produces good results rises to the top. Code that doesn’t gets buried — all without any manual intervention.
Chat messages → search cached code → execute → produce result

                                              AI evaluates quality

                                        automatic vote on all
                                        code that contributed

                                        good code promoted,
                                        bad code demoted
New code generated during execution is also AI-voted at upload time, so it enters the library with an initial quality signal immediately.

The Core Loop

Under the hood, agent.run() wraps two API calls per conversation:
  1. raysurfer.search() — find proven code that already solved similar tasks
  2. raysurfer.upload() — store any new code generated for future reuse
Search proven code → Execute → Upload new code → AI scores quality
This makes agent behavior more stable over time. Agents start from high-signal code paths and only generate new code when necessary.

Persistence

The code library persists per organization. Every agent session within the same org_id shares the same pool of proven code. This means:
  • Code uploaded by one user’s session is available to all users in the org
  • AI quality scoring affects the ranking for everyone
  • The library improves continuously without manual curation

Sandbox Execution

When agents execute code through Raysurfer, it runs in an isolated environment. This means:
  • Code runs safely without affecting your production systems
  • Execution results are captured and used for reputation scoring
  • Failed code is automatically excluded from future retrieval
  1. Add Raysurfer to one high-frequency workflow first.
  2. Track which snippets are repeatedly reused with positive scores.
  3. Expand to additional workflows once retrieval quality is stable.
Keep values parameterized in snippets. Hardcode only values you expect to be reused verbatim.

Need help planning your rollout?

Book a 15-minute call and we’ll help you pick the right workflows to start with.

Code Reputation Registry

Inspect publicly ranked snippets and quality signals that feed reuse decisions.

How It Works

Learn about proven code retrieval and reputation scoring.

Integrations

Add the same loop through Python/TypeScript SDKs, CLI, MCP, skill, or plugin.

Results

See real-world accuracy and speed improvements.