# Turn production failures into fixes you can apply.

**Status:** Live beta. Self-Improving Agents is part of CtrlB AI Observability. Agent tracing, Self-Improving Agents, Evals and Guardrails are all in live beta. Examples on the page use sample data from one scenario: a refund agent whose payment tool times out after the refund already completed, so the agent tries again.

Block a bad action with a Guard rule. Fix its cause with a pull request. Test both before you apply them.

## One finding, two fixes

A refund agent retried after an issue_refund timeout, though the payment had completed. The finding produces two proposals:

- **Action rule:** deny a repeat issue_refund when order_id and amount match a call within 10 minutes, across sessions. Validated by policy replay on the frozen case set, then applied with Apply Guard rule as a versioned rule.
- **Tool/code change:** make retries safe with an idempotency key and a payment-status read after a timeout. Your coding agent fetches the proposal and evidence through CtrlB MCP tools and opens a pull request. It ships when your team merges and deploys it.

## Rule scopes

- **Session-local rule:** identical tool calls repeated inside one session.
- **Argument-keyed window:** matching arguments across sessions within a time window. It blocks repeat attempts within the configured scope; payment telemetry shows whether the original refund completed.

## Validation and history

Both fixes reference the same frozen case set version. Guard rules are validated by replaying captured calls; prompt and code changes are executed against the cases in a controlled environment. Each change is marked from the moment it took effect, and the finding's trend separates repeat attempts, denied calls and allowed legitimate calls.

Prompts stay in your repository. There is no prompt store to load from, and the model weights do not change.

## Metadata

- **Canonical HTML**: https://ctrlb.ai/ai-observability/self-improving-agents
- **Last updated**: 2026-11-04

## FAQ

### Which fixes can CtrlB apply directly?

Action rules: choose a scope and select Apply Guard rule. Prompt and code changes go to your repository as pull requests for your team to review and deploy.

### How do prompt and code changes reach my repository?

Through MCP. Your coding agent uses CtrlB's MCP tools to fetch the proposal, its finding and the frozen evidence, then opens a pull request in your repository.

### What does the session-local loop rule cover?

Repeated calls to the same tool with the same arguments inside one session. It stops an agent looping on an identical call.

### How does the argument-keyed time window extend that scope?

Choose a key, such as order ID and amount, and a window. The rule catches matching attempts across sessions even if other arguments differ. Payment telemetry tells you whether the original refund completed.

### How do Guard replay and code evaluation differ?

Replay checks how a rule would handle captured calls. To test code, run the baseline and changed versions against the same cases in a controlled environment, with tool side effects stubbed.

### Do my agents need to load prompts from a CtrlB prompt store?

No. Prompts stay in your repository and ship through your deployment. CtrlB proposes the change; your coding agent opens the pull request.

## Related

- [AI Observability](https://ctrlb.ai/ai-observability): See agent runs alongside your application telemetry.
- [Evals](https://ctrlb.ai/ai-observability/evaluations): Turn real failures into test cases. Compare versions.
- [Guardrails](https://ctrlb.ai/ai-observability/guardrails): Set rules for tool calls and record each decision.

## Links

- [Book a demo](https://ctrlb.ai/contact?source=demo-self_improving_agents)
- [AI Observability pricing](https://ctrlb.ai/ai-observability#pricing)
- [Documentation](https://docs.ctrlb.ai/)