On the DX team at Render, we often get questions in our Discord that require more than a link to the docs. In order to answer the question effectively, someone on Render's side needs to investigate the implementation in Render's codebase, find the relevant code, and work out what it means.
For example, here’s a real question from Discord:
I'm documenting our Render setup and need a REST API for Private Link, something like the Services API reference but for listing and reading Private Link connections. I couldn't find one under api-docs.render.com. Does one exist, or is it on the roadmap? If not, I'll mark it out of scope for now.
Traditionally, we’d ping engineering or comb through the codebase ourselves to come up with an answer. That approach wasn’t scaling, so we built Codebase Researcher.
The DX team can slack Codebase Researcher questions about the platform, and an agent investigates our source code in a read-only environment and returns an answer with citations.
We needed the repositories to stay current without someone maintaining a local checkout, and each investigation needed a clean place to run. Here’s how we split that work between Cron Jobs, Sandboxes, and Workflows.
Designing the app
We split the work into two parts: preparing the code environment on a schedule, and running an investigation when a question arrives. That way, each question starts with the repositories and tools already in place, without repeating setup or requiring someone’s laptop.
Preparing the environment
An hourly Render Cron Job starts a builder Sandbox. The builder installs the tools and agent runner, clones the configured repositories at exact commits, then removes the Git credentials and makes the checkouts read-only. It verifies the environment before saving a named filesystem snapshot.
That snapshot becomes the starting point for investigations. Each investigation gets a fresh copy of the prepared environment (without the Git credentials used to build it!).
Running an investigation
- Accept the question. An HTTP API on a Render Web Service starts a workflow and returns a question ID immediately. The caller doesn’t need to keep the request open while the agent works.
- Restore and investigate. The workflow restores a fresh Sandbox from the snapshot and verifies it before supplying the model API key. The agent and its tools run inside the Sandbox, searching and reading the local, read-only repositories.
- Check the citations. The agent submits its findings through
submit_investigation, which checks citation commits, file paths, and line ranges against the manifest and checkout. The workflow checks the references against the manifest again and constructs the links. These checks establish that the references exist, not that the agent’s interpretation is correct. - Return the result and clean up. The workflow stores the reply for polling and, when requested, sends it through a callback. The Sandbox is terminated after the investigation. A follow-up starts a new investigation with the previous conversation, not the previous machine.
We chose Render Workflows to control which parts of that process retry and to keep a record of each question and answer:
- Retry infrastructure failures. The
classifyRunfunction distinguishes infrastructure failures that warrant another attempt from explicit agent failures and timeouts, which return failure replies. - Retry delivery separately. If a callback fails, the delivery task can retry without repeating the entire investigation.
- Keep the conversation in the run. Each run stores its input conversation and reply. The API uses those to reconstruct follow-up context without a separate conversation database, and we can inspect the run history when something goes wrong.
Three ideas worth stealing
1. Build once, restore fresh
Repository setup happens in a builder sandbox once an hour. Each question then restores a clean environment from the resulting snapshot.
This keeps the per-question path short without turning the agent’s workspace into a long-lived machine that accumulates state.
2. Separate repository setup from agent execution
The process that fetches private repositories needs credentials. The agent investigating those repositories doesn’t need those credentials.
The setup sequence reflects that distinction:
- Third-party setup code runs before secrets are uploaded.
- Git tokens are removed, and that removal is verified before the snapshot is taken.
- The model API key is supplied separately through a file the runner deletes after reading.
- Other processes are prevented from reading the runner’s memory.
- Network access is restricted to the model provider’s API.
The useful pattern: give each phase only the access it needs, rather than handing the agent every credential used to prepare its environment.
3. Validate citations with code
We don’t rely on the model to produce trustworthy-looking links.
submit_investigation rejects references to files, commits, or line ranges that aren’t present in the checkout. Trusted code builds the links.
This doesn’t prove the answer is correct, but it does make the evidence easier to verify and prevents a nonexistent file or invented line range from wasting our time.
Make it yours
The codebase-researcher repository is designed to be adapted. Fork it, configure the repositories in config.ts, customize the investigation instructions in prompt.md, and deploy.
The next step is closing the loop between individual investigations and reusable answers. When an uncommon question starts recurring, that’s a signal to turn what we learned into documentation.