How Rewire Built a Voice Agent That Rewrites Itself After Every Wrong Answer
Key Takeaways
- Rewire identifies agent failures, generates competing fixes, and validates them against historical calls before updating the live workflow.
- Actian VectorAI DB stores validated fixes as persistent failure patterns that can be retrieved and reused across sessions and domains.
- Rewire indexes failures by structure instead of domain vocabulary, capturing details such as failure type, node role, tools, and verification behavior.
- A brake-pricing fix was later retrieved by a healthcare agent and used to correct a fabricated insurance copay despite zero shared domain vocabulary.
- Cross-domain self-evolution depends on storing reusable failure signatures and validating every retrieved fix before it can modify a live workflow.
This build was originally submitted to the Self-Evolving Agents Hackathon.
Rewire‘s voice agent fabricated a brake price, traced the failure to the responsible node, generated 33 competing fixes, eliminated 27 in validation, and committed the surviving patch to Actian VectorAI DB memory. A healthcare agent built by Rewire later retrieved that patch, matched it to a fabricated insurance copay, and corrected the error on the first try, with zero shared vocabulary between the two domains.
That transfer works because Rewire indexes failure patterns by structure instead of the language of the call that produced them. The embedding captures the failure type, the node role, the available tools, and whether the agent asserted a value it had never verified.
What survives that process is a failure pattern precise enough for retrieval to match even when the domain, the caller, and the question are all different. As Aayush Gupta, who built Rewire, described it, “We wrote the fitness function. It wrote the rules.”
If you are building a self-evolving agent, this case study covers what failure representation to store and how to validate a retrieved fix before it touches a live workflow.
TL;DR
- Rewire identifies and fixes agent failures autonomously. It traces the failure to the responsible workflow node, generates competing fixes, and validates them against previous calls.
- VectorAI DB gives those fixes persistent memory. Rewire stores validated fixes as reusable failure patterns.
- The memory transfers across domains. A healthcare agent retrieved a fix originally generated from a brake-pricing failure and used it to correct a fabricated copay.
Why Prompt Engineering is the Wrong Fix
A manual prompt patch can fix a known failure, but it only applies to one instance. If the same mistake appears in another workflow, you have to find it, rewrite the prompt, and hope the next call does not fail differently. A prompt update that tells Rewire to retrieve the approved price before answering does not guarantee the agent will call the lookup tool next time.
Prompts change a model’s behavior probabilistically. Without a mechanism to connect two failures, the agent’s memory never learns that the same error applies to another domain, such as a healthcare copay or an insurance deductible. A different conversation will expose the same failure case.
Retrieval-Augmented Generation (RAG) improves what an agent retrieves, but Rewire modifies the instruction or workflow behavior that failed to invoke retrieval on the first call. The voice agent mutates its execution environment after each incident, while semantic memory stores recurring failure patterns as reusable context. Aayush describes Rewire’s approach to agent failures this way: “Our voice agent finds its own bugs and rewrites its own conversation graph. Nobody touches a prompt.”
How the Self-Rewriting Loop Works
Rewire’s self-evolving agent loop turns agent failure into validated changes to the conversation graph across five components.
Dograh orchestrates and versions the conversation flow, Pioneer serves the agent’s inference, and Senso evaluates each response against verified knowledge and stores the escalation policy. The system’s validator traces failures to the root node, generates competing patches, compares them locally against historical calls, and updates the live graph. Actian VectorAI DB stores the domain-free failure signatures and patch data for the surviving fixes.
This diagram shows how Rewire moves a failure through diagnosis, fix generation, validation, and memory commit.

Pioneer and Senso
Pioneer generates the agent’s behavior, and Senso provides the verified knowledge used to evaluate that behavior.
Pioneer’s OpenAI-compatible endpoint serves the gpt-5.4-mini model that generates the agent’s responses. Each call produces execution data for the workflow, including the node, instructions, available tools, tool calls, and transitions. Rewire uses these traces to determine how the agent produced a response and where a failure occurred.
Senso provides the evaluation signal. Its search endpoint retrieves the verified answer and supporting citation for the caller’s question. SensoOracle compares the agent’s response with that evidence and returns a structured verdict with the correctness score, groundedness, ground-truth value, failure type, diagnostic reasoning, and escalation result. Every candidate fix is evaluated against this verdict before Rewire can promote it.
This separation gives the loop both sides of the failure. Pioneer shows what the agent did, while Senso establishes what the agent should have done based on verified knowledge. In the pricing failure, the agent had access to the knowledge-base tool but did not invoke it. Senso provided the verified price, so Rewire could identify the incorrect response and feed it into the evolution loop.
Node identification and competing fix generation
Rewire first identifies which node caused the failure, then generates three competing fixes for that node rather than committing to a single fix.
The node that produced the incorrect response can differ from the node that caused the underlying problem. Rewire uses Dograh’s node_transition events and the execution history to trace the failure to its root node. It then creates a failure signature from the failure structure and uses it to determine which of the four mutation operators below are appropriate:
append_constraintadds a behavioral constraint to the node’s existing instruction.add_tool_requirementrequires the node to invoke a specific tool under a defined condition.rewrite_instructionreplaces a node’s existing instructions.change_transitionchanges the graph’s routing.
Rewire selected add_tool_requirement for the brake pricing failure. The patch updated pricing_lookup to require a knowledge-base lookup before providing specific pricing information.
Before Rewire can apply that change to the live graph, the Guild-hosted validator must test it. The validator applies each patch to a local copy of the workflow and replays it against historical calls. Rewire keeps a candidate only when it fixes the triggering failure without breaking previously correct behavior. The system promotes the surviving fix with the highest validation confidence score to the live graph.
The Actian memory commit
Actian VectorAI DB stores validated fixes by failure shape so that Rewire can retrieve them across domains.
Rewire builds the vector from the failure signature. The signature captures the failure type, node role, available tools, tool invocation, and whether the agent asserted a specific value. It excludes the caller’s question and domain-specific terms, so retrieval focuses only on the failure’s structure.
This code block shows the exact point a validated patch enters VectorAI DB:
def store(self, patch: WorkflowPatch) -> str:
"""Embed the patch's failure signature, upsert with its flat payload.
Returns the Actian point id (a uuid5 of `patch.patch_id`, so this is a
true upsert — storing the same patch twice after validation flips it
from candidate to promoted in place rather than duplicating it).
"""
self._require_ready()
vector = embed(patch.signature.to_embedding_text())
pid = point_id_for(patch.patch_id)
self.client.points.upsert(
self.collection,
[PointStruct(id=pid, vector=vector, payload=patch.to_actian_payload())],
)
return pid
Failure pattern indexed by shape and committed to VectorAI DB after surviving replay.
signature.to_embedding_text() produces the text that Rewire embeds for retrieval. The store() method converts the failure signature into a 384-dimensional vector, derives a deterministic ID from the patch ID, and upserts both the vector and patch payload into the collection. Reusing the same patch ID updates the existing point instead of creating a duplicate.
For the cross-domain demo, Aayush ran a healthcare agent with a separate failure case. It fabricated a $40 insurance copay against a verified $47, then retrieved the brake-pricing patch from VectorAI DB. The failure signature contained no healthcare terms, but the shared pattern was that the agent asserted a specific value without using an available verification tool. If Rewire embedded the caller’s question or domain-specific keywords, retrieval would depend on vocabulary.
The Cross-Domain Result and What it Means for Your Agent
The healthcare failure worked because Rewire indexed the structure of the failure rather than its domain. The signature included the properties both failures shared, so VectorAI DB could retrieve the brake-pricing fix even though the healthcare failure contained no automotive terms.
Aayush described this result as an unexpected outcome of the system: “Then the part we didn’t design for: the rule it learned about brake pricing was retrieved from Actian by a healthcare agent, different domain, zero shared vocabulary, matched purely on the shape of the failure, and fixed a fabricated insurance copay first try.”
If you want cross-domain retrieval in your own self-evolving agent, embed only the failure representation you want the system to reuse. Indexing the full conversation feeds domain-specific language into the retrieval signal and can constrain which failures match. Rewire keeps that representation at the level of the failure signature. Retrieval supplies a candidate fix, but Rewire validates that fix before allowing it to change the graph. A patch generated in one workflow can reach another only after it passes the same evaluation process.
The table below captures three patterns in Rewire’s design you can implement in your agent architecture today.
| Pattern | What Rewire did | What you implement |
| Index by shape | Encoded failure signatures using structural properties and stored them in VectorAI DB without domain content | Define a normalized failure schema that captures how the agent failed, then embed that representation for retrieval |
| Eliminate by replay | Tested generated and retrieved fixes against the triggering failure and historical calls; Rewire promoted only fixes that resolved the failure without introducing regressions | Apply every candidate fix to the current workflow, replay representative historical cases, and promote it only after it passes the regression gate |
| Let the agent write the rules | Allowed the agent to propose graph updates within a bounded set of mutation operators, then validated the resulting workflow | Give the agent control over the behavioral rule it proposes, constrain the available mutation operators, and let execution-based validation decide which rules survive |
Cross-domain reuse depends on the failure representation stored in memory and the validation applied before reuse. VectorAI DB gave Rewire persistent storage for validated failure patterns, so a fix learned in one session can become available when another agent encounters the same failure structure.
Try VectorAI DB Community Edition on your local machine with Docker pull.
This build was originally submitted to the Self-Evolving Agents Hackathon. View the Rewire project on GitHub.