AI Engineer · Published 2026-07-22

Active Graph Agent Runtime (BabyAGI 4) — Yohei Nakajima, Untapped Capital

Open on YouTube ↗

Summary

Overview

  • Speaker: Yohei Nakajima
  • Channel: AI Engineer
  • Main topic: ActiveGraph: An Event-Sourced Graph Runtime for Building Auditable AI Agents
  • Purpose: To introduce ActiveGraph, explain its underlying architecture and philosophy, and share experimental results regarding its use in memory, self-improvement, and complex agent design. Yohei Nakajima introduces ActiveGraph, an experimental open-source runtime for building AI agents that shifts from an LLM-centric approach to a log-centric, event-sourced graph architecture. Drawing on his three years of building BabyAGI across nine iterations, Nakajima discusses why long-running agents break, how mutable immutable event logs serve as ground truth, and how behaviors react to graph changes to provide capabilities like rollbacks, forks, and replays.

Topic Map

Introduction and Evolution of BabyAGI

  • Explanation: Background on BabyAGI and three years of iterating on autonomous agent frameworks, leading to the creation of ActiveGraph.
  • Key claims:
    • Agents are awesome, but long-running agents break.
    • Over three years, nine iterations of BabyAGI were created to explore self-improvement.
    • Experimentation across various graphs (instagraf, mindgraph, code graphs, log graphs) led to ActiveGraph.
  • Examples:
    • BabyAGI started in March 2023.
    • Evolution through instagraf, mindgraph, code graphs, and log graphs.
  • Terminology:
    • BabyAGI
    • ActiveGraph
    • Untapped Capital
  • Why it matters: Contextualizes the architectural pivot toward event-sourced graph runtimes for agent building.

LLM-Centric vs. Log-Centric Architecture

  • Explanation: Contrasting traditional LLM-centric agent building with ActiveGraph's log-centric model where the immutable event log is ground truth.
  • Key claims:
    • Traditional agent building starts with an LLM and adds response APIs, tools, and memory.
    • ActiveGraph builds around the log: everything the agent does and every change to the agent is tracked in an immutable event log.
    • The event log projects a graph representing the agent state.
  • Examples:
    • Treating the immutable event log as ground truth.
    • Projecting agent state into a graph of nodes and edges.
  • Terminology:
    • LLM-centric
    • Log-centric
    • Immutable event log
    • Projected graph
    • Behaviors
    • Policies
  • Why it matters: Establishes a unified shared state for all agent behaviors instead of disconnected components.

Behaviors, Policies, and Packs

  • Explanation: Detailed breakdown of how behaviors react to graph changes, how policies govern modifications, and how components are bundled into packs.
  • Key claims:
    • Behaviors react to graph changes and emit events that update agent state.
    • Behaviors can be deterministic or include LLMs.
    • Policies determine how the graph can be modified (e.g., requiring approval or human-in-the-loop).
    • Packs bundle object types, relationship types, behaviors, tools, prompts, and policies.
  • Examples:
    • Planner behavior triggering on goal_created to add tasks.
    • Relation behaviors like unblock running when research is done.
    • Contradiction detector subscription pattern.
  • Terminology:
    • Behaviors
    • Policies
    • Packs
    • Relation behavior
    • Graph query
    • Views
  • Why it matters: Provides modularity and safety controls for complex multi-agent and long-running workflows.

Experiments and Findings

  • Explanation: Results from experiments testing ActiveGraph as memory, self-improvement loops, autonomous research labs, and Pokemon TCG Kaggle competitions.
  • Key claims:
    • Using the structured log as memory achieved 85.6% on LongMemEval without semantic ingestion, and 87.2% with LLM fact extraction.
    • When an API key ran out during LongMemEval, reloading the API key allowed the agent to pick up exactly where it left off.
    • Self-improvement loops (regimes) resulted in statistically significant score improvements.
    • ActiveGraph Lab reads blog posts and GitHub repos to self-improve and submit PRs.
  • Examples:
    • LongMemEval memory evaluation.
    • Regimes experiment on self-modification.
    • Pokemon TCG AI Battle Challenge on Kaggle.
    • Autonomous research lab reading ActiveGraph blogs and PRing its own code.
  • Terminology:
    • LongMemEval
    • Regimes
    • ActiveGraph Lab
    • ELO style competition
    • Experiential world model
  • Why it matters: Demonstrates practical benefits like persistence, error recovery, and self-improvement in real-world benchmarks.

Key Points

The Log is the Agent

  • Explanation: Instead of tracking actions and state changes in separate silos, ActiveGraph treats the immutable event log as the single source of truth.
  • Evidence: Paper 'The Log is the Agent: Event-Sourced Runtime for Auditable Multi-Agent Systems'.
  • Practical implication: Enables native replays, rollbacks, and forks without building custom checkpointing logic.

Behaviors over Monolithic Loops

  • Explanation: Agents are composed of modular behaviors that subscribe to graph changes and emit new events, avoiding monolithic while-loops.
  • Evidence: Code examples showing @behavior decorators listening to graph events.
  • Practical implication: Improves modularity, auditability, and allows mixing deterministic logic with LLM calls.

Resilience and Zero-Loss Recovery

  • Explanation: Because state is fully captured in the event log, failures like API key exhaustion do not require restarting from scratch.
  • Evidence: During LongMemEval testing, restarting after an API key error resumed execution from the exact failed question.
  • Practical implication: Saves compute costs and eliminates frustration in long-running agent workflows.

Frameworks, Models & Processes

ActiveGraph Architecture

  • How it works: An event-sourced graph runtime where agents emit immutable events, project state into graphs, and react via behaviors governed by policies.
  • Components:
    • Immutable Event Log
    • Projected Graph State
    • Behaviors
    • Policies
    • Packs
  • When to use: Building long-running, auditable, and self-improving AI agents.

Examples & Case Studies

During a 500-question benchmark run on LongMemEval, the API key ran out of credits at question 350.

  • Illustrates: Error resilience in ActiveGraph.
  • Lesson: Reloading the API key allowed the agent to resume seamlessly from question 351 without restarting the entire run.

An autonomous research lab (ActiveGraph Lab) read its own blog posts and GitHub repo.

  • Illustrates: Self-improving agent systems.
  • Lesson: The agent found an error in its own code, wrote a PR, and successfully merged it.

Actionable Takeaways

  • Immediate:
    • Check out ActiveGraph on GitHub and activegraph.ai
    • Replace message arrays with immutable event logs in agent design
    • Explore ActiveGraph packs for modular agent construction
  • Strategic:
    • Shift agent architecture from LLM-centric loops to log-centric event sourcing
    • Combine experiential world models (event logs) with predictive world models (LLM priors) for long-running agents
    • Treat agent identity and knowledge as derivatives of their historical event logs
  • Questions to investigate:
    • How do experiential world models scale with massive enterprise logs?
    • Can policies fully automate safety guarantees in self-modifying agent systems?

Claims Worth Verifying

  • ActiveGraph achieves 85.6% on LongMemEval without semantic ingestion and 87.2% with LLM fact extraction. (Benchmark performance)
  • Event-sourced graph runtimes natively support replays, rollbacks, and forks. (Architectural capability)

Notable Quotes

"agents are awesome, but long-running agents break, and if they're so awesome, why am I still building them? They should build themselves." (at 0:36) "what if you built around the log?" (at 3:41) "you are not your reasoning capability, you are your beliefs, knowledge, and behaviors, derived from your life experience" (at 27:19)

Compressed Summary

  • ActiveGraph is an event-sourced graph runtime for building auditable AI agents.
  • Replaces traditional message arrays with an immutable event log as ground truth.
  • Behaviors react to graph changes and emit events; policies govern modifications.
  • Provides native replays, rollbacks, forks, and robust error recovery.
  • Enables self-improving agent architectures and modular agent packs.
  • Keywords: activegraph, event-sourcing, agents, graph-runtime, babyagi
  • Core insight: Building agents around an immutable event log rather than an LLM loop provides native auditability, rollbacks, forks, and error resilience.

Core insights

7
Architecturehigh noveltystrong evidence

ActiveGraph inverts the standard agent stack: instead of an LLM loop with bolted-on memory, the immutable event log is the ground truth and the graph is a derived projection, so replay, rollback, and fork become runtime primitives rather than custom checkpointing code.

Why it matters

It relocates the source of truth from mutable in-process message state to an append-only log, which changes where checkpointing, recovery, and audit responsibilities live in an agent system.

Generalization

Any stateful long-running system benefits from treating the log (not in-memory state) as canonical, enabling time-travel debugging and branching without bespoke snapshot logic.

everything the agent does and every change to the agent is tracked in an immutable event log
Open source video
The event log projects a graph representing the agent state.
Open source video
Enables native replays, rollbacks, and forks without building custom checkpointing logic.
Open source video
Empirical Resulthigh noveltymoderate evidence

Using the structured event log directly as memory scored 85.6% on LongMemEval with no semantic ingestion, rising to 87.2% only when LLM fact extraction was added—suggesting an embeddings/vector-retrieval pipeline may be unnecessary for agent memory when the log is already structured.

Why it matters

It challenges the default assumption that agent memory requires a semantic retrieval layer, and quantifies the marginal gain of LLM fact extraction over a plain structured log.

Generalization

For event-sourced agents, memory retrieval can be reduced to queries over structured history, potentially eliminating embedding infrastructure and its staleness/recall failure modes.

Using the structured log as memory achieved 85.6% on LongMemEval without semantic ingestion, and 87.2% with LLM fact extraction.
Open source video
Mechanismmedium noveltystrong evidence

Agents are decomposed into modular behaviors that subscribe to graph changes and emit new events, replacing a single monolithic while-loop; behaviors can be deterministic or contain LLM calls.

Why it matters

It makes orchestration a publish/subscribe reaction to state deltas rather than imperative control flow, letting deterministic and LLM logic coexist in one system with clearer audit boundaries.

Generalization

Event-driven behavior composition is a general alternative to central orchestrator loops for complex, long-running workflows.

Behaviors react to graph changes and emit events that update agent state.
Open source video
Behaviors can be deterministic or include LLMs.
Open source video
Improves modularity, auditability, and allows mixing deterministic logic with LLM calls.
Open source video
Architecturemedium noveltystrong evidence

Graph mutation is governed by a separate policy layer that can require approval or human-in-the-loop, decoupling 'what triggers a change' (behaviors) from 'whether a change is permitted' (policies).

Why it matters

It introduces a first-class governance/safety boundary in the runtime rather than scattering permission checks through behavior code, which is critical for autonomous or self-modifying agents.

Generalization

Safety controls should be a declarative, orthogonal layer over an action substrate, not embedded in each action's implementation.

Policies determine how the graph can be modified (e.g., requiring approval or human-in-the-loop).
Open source video
an event-sourced graph runtime where agents emit immutable events, project state into graphs, and react via behaviors governed by policies
Open source video
Mechanismmedium noveltystrong evidence

Because full state lives in the event log, mid-run failures (e.g., API credits exhausted at question 350 of 500) resume at the exact failed step after the credential is restored, with no need to restart the run.

Why it matters

Crash resilience becomes a property of the storage model rather than ad-hoc retry logic, directly reducing recompute cost and operator friction in long-running jobs.

Generalization

Durable, replayable state logs convert expensive full restarts into cheap incremental resumption for any long-running pipeline.

When an API key ran out during LongMemEval, reloading the API key allowed the agent to pick up exactly where it left off.
Open source video
During LongMemEval testing, restarting after an API key error resumed execution from the exact failed question.
Open source video
Empirical Resulthigh noveltymoderate evidence

Self-improvement loops ('regimes') produced statistically significant score improvements, and an autonomous lab reading its own blog posts and repo found a bug, wrote a PR, and merged it.

Why it matters

It is a concrete demonstration of closed-loop self-modification with external artifact submission, not just prompt tinkering—an important data point for self-improving agent design.

Generalization

Agents whose own history and code are queryable artifacts can be positioned as contributors to their own maintenance pipeline.

Self-improvement loops (regimes) resulted in statistically significant score improvements.
Open source video
ActiveGraph Lab reads blog posts and GitHub repos to self-improve and submit PRs.
Open source video
The agent found an error in its own code, wrote a PR, and successfully merged it.
Open source video
Architecturemedium noveltymoderate evidence

Packs bundle object types, relationship types, behaviors, tools, prompts, and policies into a single distributable unit, making agent capabilities composable rather than project-specific wiring.

Why it matters

Packaging behaviors together with their data schemas and governance rules turns agent construction into dependency composition, with policies shipped alongside capabilities.

Generalization

Bundling data models, logic, and constraints into one versioned artifact is a reusable pattern for distributing composable agent modules.

Packs bundle object types, relationship types, behaviors, tools, prompts, and policies.
Open source video
Explore ActiveGraph packs for modular agent construction
Open source video

Deep dives

0
No deep dives.

Article ideas

0
No article ideas.

Project ideas

0
No project ideas.

Architectural implications

4

The source of truth moves from mutable in-process conversation state to an append-only event log that projects into a graph.

Before

LLM-centric agent: start with an LLM, add response APIs, tools, and memory, keep message arrays as state.

After

Log-centric agent: everything the agent does and every change to the agent is written to an immutable event log, with graph state derived from it.

Consequence

Replay, rollback, fork, and crash recovery become runtime-level capabilities instead of per-project checkpoint code.

Source video

Orchestration shifts from a monolithic control loop to event-subscription behaviors.

Before

Monolithic while-loop that sequences steps and calls the LLM directly.

After

Modular behaviors that react to graph changes and emit events, mixing deterministic logic with LLM calls.

Consequence

Behavior boundaries become the natural unit for testing, audit, and replacement.

Source video

Authorization and safety move out of behavior code into a declarative policy layer over graph mutations.

Before

Permission and approval logic embedded inside each agent action.

After

Policies that determine how the graph can be modified, including requiring approval or human-in-the-loop.

Consequence

Safety posture can change without rewriting behaviors, enabling HITL gates on self-modifying agents.

Source video

Agent capabilities are distributed as packs rather than assembled per project.

Before

Ad-hoc assembly of object schemas, tools, prompts, and behaviors per agent.

After

Packs bundling object types, relationship types, behaviors, tools, prompts, and policies.

Consequence

Governance rules travel with the capability, reducing drift between what a module does and how it is constrained.

Source video

Tradeoffs and failure modes

3

Policy-gated graph mutation vs autonomous throughput

Benefit

Policies allow requiring approval or human-in-the-loop before the graph is modified, providing a safety gate for risky or irreversible actions.

Cost or risk

Requiring approval or human-in-the-loop can stall long-running autonomous workflows and add latency, undermining the persistence benefits of the event log (cost inferred from the approval requirement).

Policies determine how the graph can be modified (e.g., requiring approval or human-in-the-loop).
Open source video
Source video

Structured log as memory vs semantic retrieval pipeline

Benefit

The structured log reached 85.6% on LongMemEval without semantic ingestion, avoiding an embedding/indexing pipeline.

Cost or risk

The result is from a single benchmark (LongMemEval) and the higher 87.2% required LLM fact extraction, implying added LLM cost/processing; generalization to other memory tasks is unestablished.

Using the structured log as memory achieved 85.6% on LongMemEval without semantic ingestion, and 87.2% with LLM fact extraction.
Open source video
Source video

Immutable event log as canonical state

Benefit

Enables native replays, rollbacks, and forks without building custom checkpointing logic.

Cost or risk

An append-only log grows unbounded and graph state must be projected from it; the summary gives no evidence on projection cost or compaction strategy (cost inferred).

Enables native replays, rollbacks, and forks without building custom checkpointing logic.
Open source video
Source video

Open questions

5

Does using the structured event log as memory hold up outside LongMemEval and at larger history scales, or does it degrade relative to semantic retrieval as logs grow?

Why unresolved

Only a single benchmark result (85.6% / 87.2%) is reported, with no comparison to embedding-based retrieval baselines.

Research direction

Run head-to-head evaluations of log-query memory vs vector-retrieval memory across multiple long-horizon memory benchmarks and history sizes.

Source video

What is the cost of projecting graph state from an ever-growing event log, and when are snapshots or compaction preferable?

Why unresolved

The summary states the log projects a graph but gives no data on projection latency, memory, or storage growth.

Research direction

Measure projection cost against log length and prototype snapshot/compaction strategies that preserve replay and fork semantics.

Source video

How are 'statistically significant' self-improvement gains measured and prevented from degenerating or overfitting the evaluation?

Why unresolved

The summary asserts statistical significance for regimes but does not describe the evaluation methodology or guardrails against reward hacking.

Research direction

Define and publish the regimes experiment protocol, including holdout evaluation and detection of self-referential overfitting.

Source video

How do policies compose across multiple packs and agents, and what happens when a policy blocks a behavior mid-run?

Why unresolved

Policies and packs are described independently with no detail on composition or conflict resolution across bundles.

Research direction

Build multi-pack scenarios and test policy precedence, conflict handling, and recovery when a mutation is denied.

Source video

What is the migration path from message-array, LLM-centric agents to a log-centric event-sourced runtime?

Why unresolved

The talk contrasts the two paradigms and recommends replacing message arrays with immutable event logs, but gives no migration mechanics.

Research direction

Prototype a conversion layer that maps existing agent trajectories into event-sourced graphs and measure fidelity of resulting replay/rollback.

Source video

Key claims

7
factualVerification needed

The immutable event log, not in-memory state, is the agent's single source of truth, with the graph projected from it.

Evidence

Instead of tracking actions and state changes in separate silos, ActiveGraph treats the immutable event log as the single source of truth.

Question

What is the cost and latency of reconstructing full graph state from the event log compared to maintaining mutable state directly?

Source video
comparativeVerification needed

Structured log memory achieved 85.6% on LongMemEval without semantic ingestion and 87.2% with LLM fact extraction.

Evidence

Using the structured log as memory achieved 85.6% on LongMemEval without semantic ingestion, and 87.2% with LLM fact extraction.

Question

How does this compare against embedding-based retrieval baselines on LongMemEval and on other memory benchmarks?

Source video
causalVerification needed

Full state capture in the log allowed an interrupted run to resume at the exact failed step instead of restarting.

Evidence

When an API key ran out during LongMemEval, reloading the API key allowed the agent to pick up exactly where it left off.

Question

Does resumption require idempotent side effects, and what happens to non-deterministic LLM calls in the replayed portion?

Source video
causalVerification needed

Self-improvement loops (regimes) produced statistically significant score improvements.

Evidence

Self-improvement loops (regimes) resulted in statistically significant score improvements.

Question

What evaluation protocol, sample size, and holdout design established statistical significance?

Source video
factualVerification not requested

Policies are a separate layer governing how the graph may be modified, including requiring approval or human-in-the-loop.

Evidence

Policies determine how the graph can be modified (e.g., requiring approval or human-in-the-loop).

Source video
factualVerification needed

An autonomous lab reading its own blog posts and repo identified a code error, wrote a PR, and merged it.

Evidence

The agent found an error in its own code, wrote a PR, and successfully merged it.

Question

How was the PR validated, and did a human review or gatekeeper approve the merge?

Source video
factualVerification not requested

Behaviors react to graph changes and emit events, and may be deterministic or contain LLM calls.

Evidence

Behaviors react to graph changes and emit events that update agent state.

Source video

Connections

5