Kapso's Iterative Learning Loop: Enterprise Agents That Build Knowledge Graphs Without Retraining Kapso has built an iterative learning loop that lets enterprise AI agents grow a mutable knowledge graph from experimental evidence rather than retraining or upfront ontology design. The system runs a three-stage cycle of investigation, sandboxed experimentation and graph mutation, with a stateless orchestrator, containerized sandbox, ACID graph store and append-only experiment log; conflicting edges are resolved by recency of evidence and deprecated rather than deleted. Kapso cites a reference project migrating 30+ source systems, thousands of tables and hundreds of BI reports to a lakehouse as the kind of messy environment the approach targets. Most enterprise AI agents treat knowledge as static. You embed documents, index them, and hope retrieval finds the right context. Kapso takes a different approach: it runs experiments against enterprise data, learns from the results, and updates a knowledge graph incrementally. No retraining cycles. No upfront ontology design. Just a feedback loop that compounds understanding across investigations. The architecture matters because enterprise data environments are messy. One of Kapso's reference projects involved migrating 30+ source systems, thousands of tables, and hundreds of BI reports to a lakehouse. No single person or agent understood how the estate connected. The only path forward was iterative: investigate repos and dbt models, propose hypotheses about data lineage, run experiments, observe failures, and update the knowledge graph with what worked. Kapso's core is a three-stage cycle: This differs from RAG-only systems in two ways. First, retrieval is not the end state. It feeds into hypothesis generation. Second, the knowledge graph is mutable. Each experiment can add nodes new entities , edges relationships , or attributes constraints learned from failures . Kapso maintains three state layers: The session state is ephemeral. When an agent completes an investigation, the session closes, but confirmed knowledge moves into the graph. This separation prevents partial or speculative updates from polluting the shared knowledge base. The decision logic is straightforward: The mutation path includes a conflict resolution step. If two agents propose contradictory edges e.g., "Table A feeds Report B" vs. "Table A does not feed Report B" , the system prioritizes the hypothesis with more recent experimental evidence. Older edges are marked as deprecated, not deleted, so you can trace how understanding evolved. Here's the deployment shape: | Component | Role | Failure Mode | |---|---|---| | Orchestrator | Manages agent lifecycle, schedules experiments, routes queries | Deadlock if circular dependencies in hypotheses | | Sandbox | Isolated environment for running experiments SQL, dbt, Python | Resource exhaustion if experiments don't timeout | | Graph Store | Persists knowledge graph with ACID guarantees Neo4j, TigerGraph | Stale reads if replication lag exceeds session TTL | | Experiment Log | Append-only log of all test runs S3, Postgres with JSONB | Unbounded growth without retention policy | | Retrieval Layer | Embeds documents and queries for investigation phase Pinecone, Qdrant | Embedding drift if documents update without reindex | The orchestrator is stateless. It reads session state from the graph store, dispatches experiments to the sandbox, and writes results back. This makes horizontal scaling simple: spin up more orchestrator instances and point them at the same graph store. The sandbox is where risk lives. Experiments run arbitrary code SQL queries, dbt transformations, Python scripts . Kapso isolates each experiment in a containerized environment with resource limits CPU, memory, wall-clock time . If an experiment hangs or consumes too much memory, the sandbox kills it and logs the failure. The agent learns that the hypothesis was invalid or too expensive. Here's a simplified version of how Kapso runs an experiment and updates the graph: python def run experiment hypothesis, sandbox, graph store, experiment log : """ Execute a hypothesis in the sandbox and update the knowledge graph. """ session id = hypothesis.session id experiment id = generate id Step 1: Prepare sandbox environment sandbox.reset sandbox.load context hypothesis.required tables Step 2: Execute hypothesis test try: result = sandbox.execute code=hypothesis.test code, timeout seconds=300, max memory mb=2048 success = result.exit code == 0 and result.assertions passed except SandboxTimeout: success = False result = {"error": "timeout"} except SandboxOOM: success = False result = {"error": "out of memory"} Step 3: Log experiment experiment log.append { "experiment id": experiment id, "session id": session id, "hypothesis": hypothesis.description, "success": success, "result": result, "timestamp": now } Step 4: Update graph if successful if success: graph store.add edge source=hypothesis.source entity, target=hypothesis.target entity, relationship=hypothesis.relationship type, metadata={ "experiment id": experiment id, "confidence": result.confidence score } else: Store negative example graph store.add negative edge source=hypothesis.source entity, target=hypothesis.target entity, relationship=hypothesis.relationship type, reason=result.get "error" return success The key detail: negative edges. When an experiment fails, Kapso doesn't just discard the hypothesis. It stores the failure in the graph so future investigations don't repeat the same mistake. This is how the system compounds learning. You need visibility into which documents or experiments caused graph changes. Kapso exposes three observability hooks: The mutation log is append-only. You can replay it to reconstruct the graph at any point in time. This is useful for debugging when an agent makes a bad decision based on outdated knowledge. When multiple agents iterate on overlapping data sources, conflicts are inevitable. Kapso handles this with optimistic locking at the graph level: This prevents lost updates but introduces retry overhead. In practice, conflicts are rare because agents work on different subgraphs different source systems or BI reports . When conflicts do occur, the retry loop usually resolves them within one or two attempts. Kapso is not a SaaS. It's an engine you deploy in your own infrastructure. The reference architecture assumes: The sandbox is the bottleneck. Each experiment needs its own isolated environment, which means spinning up containers. If you're running hundreds of experiments per hour, you need a cluster with enough capacity to handle the burst. Kapso includes a queueing layer backed by Redis or RabbitMQ to smooth out spikes. Enterprise data is sensitive. Kapso enforces three security layers: The sandbox isolation is critical. If an experiment runs malicious code intentionally or via prompt injection , it can't exfiltrate data or pivot to other systems. The container dies when the experiment completes, and all state is discarded. Kapso is overkill for simple retrieval tasks. If you just need to answer questions from a static document corpus, use a vector store and a retrieval-augmented generation pipeline. Kapso is for environments where: The reference use case migrating a data estate is a good fit because the knowledge graph starts empty. You don't know how tables connect or which transformations feed which reports. The only way to learn is to investigate, experiment, and update the graph as you go. Skip Kapso if: The system also assumes you have engineering resources to write experiment code SQL, dbt, Python . If your agents need to generate and run arbitrary experiments without human oversight, you're in reinforcement learning territory, and Kapso's supervised experiment loop won't help. Kapso exposes the plumbing of continuous learning agents: stateful update cycles, conflict resolution in graph mutations, and observability for incremental knowledge extraction. It's a good fit for enterprise data projects where the knowledge base is incomplete and you need to compound learning across investigations. The architecture is sound stateless orchestrator, isolated sandbox, versioned graph store , but the operational overhead is real. You need Kubernetes, a managed graph database, and enough compute to run experiments in parallel. Use it when you're migrating data estates, building lakehouses, or investigating complex systems where no one has the full picture. Avoid it if your knowledge base is static, your agents don't need to run experiments, or you can't justify the infrastructure cost.