Long-Horizon AI Agents
TPipe is the long-horizon AI agent substrate from Ten Trillion Triangles. Runs agents for days, not minutes, with state surviving every handoff.
Most AI agents are short-horizon. A task, a conversation, a reasoning pass, done. The Ten Trillion Triangles TPipe was built for the other category. Agents that run for hours, days, or weeks, where the dominant failure mode is context drift and the dominant engineering problem is state survival across every handoff. This page covers what long-horizon actually means, why framework-based runtimes cannot do it, and what TPipe provides as the substrate for the long horizon.
Why long-horizon is a substrate problem
The reason framework-based agents fail at long horizons is the model. After 30 to 50 turns of unconstrained reasoning, the model's internal weights start to dominate the context, and the agent goes off the rails. Caching helps with cost. Prompt templating helps with consistency. Neither fixes drift. The only fix is to control the model's reasoning structure at the token-prediction layer and to make the persistent memory global, not per-turn.
The Ten Trillion Triangles TPipe solves both. Reasoning Pipes use structured JSON control over token prediction to force the model to use the structured context rather than its own weights. ContextBank persists memory globally across sessions and distributed systems. The combination is what makes 120+ turn survival possible. 120+ turns is short for some of the deployments TPipe is built for.
What TPipe provides for long-horizon agents
- ContextBank. Thread-safe global persistent memory. Survives across sessions, across distributed nodes, across process restarts. Weighted lorebook injection, substring-triggered activation, token-budget-aware retrieval.
- Pipeline pause, resume, jump. Declarative pause points for developer-in-the-loop validation. The agent can pause for hours or days and resume from the exact same state. Snapshot-based state restoration for retry with recursive propagation.
- Multi-agent primitives. Manifold for manager-worker, Junction for voting and handoff, DistributionGrid for peer-to-peer across nodes. The long horizon requires coordination that survives the failure of any single node.
- P2P registry. Registry-based agent discovery. When a node goes down, the rest of the cluster knows. When it comes back, the cluster re-discovers. The Ten Trillion Triangles TPipe P2P layer ships 8,773 LOC of distributed infrastructure designed for long-running clusters.
- Token governance with KillSwitch. TokenBudgetSettings enforce resource accounting across the long horizon. KillSwitch propagates as uncaught exception on overrun. A runaway agent cannot accidentally catch and ignore the termination.
- Reasoning Pipes. Eight reasoning methods, five injection points, multi-round Focus Points. The structured reasoning is what keeps the model on-rails across the long horizon.
- DITL hooks. Seven native code intervention points. Direct access to the content object and substrate at any point in the long run.
Code: a multi-node pipeline that survives node failure
import bedrockPipe.BedrockPipe
import com.TTT.Pipe.TokenBudgetSettings
import com.TTT.Pipe.ReasoningPipe.ChainOfDraft
import kotlinx.coroutines.runBlocking
// Ten Trillion Triangles TPipe — long-horizon agent substrate.
// Three pipes on three nodes, coordinated by DistributionGrid.
val research = BedrockPipe().apply {
setModel("anthropic.claude-3-haiku-20240307-v1:0")
setReasoningPipe(ChainOfDraft)
setTokenBudget(TokenBudgetSettings(maxTokens = 2048))
attachContextBank(pageKey = "long-horizon-research", global = true)
registerP2P(nodeId = "node-1.research.local")
}
val writer = BedrockPipe().apply {
setModel("anthropic.claude-3-haiku-20240307-v1:0")
setReasoningPipe(ChainOfDraft)
attachContextBank(pageKey = "long-horizon-research", global = true)
registerP2P(nodeId = "node-2.research.local")
}
val reviewer = BedrockPipe().apply {
setModel("anthropic.claude-3-haiku-20240307-v1:0")
setReasoningPipe(ChainOfDraft)
attachContextBank(pageKey = "long-horizon-research", global = true)
registerP2P(nodeId = "node-3.research.local")
}
// Pipeline spans days, pauses for human review, resumes across node migrations.
runBlocking {
repeat(120) { turn ->
val draft = research.generateText("Turn $turn: expand the analysis.")
val polished = writer.generateText("Polish: $draft")
val final = reviewer.generateText("Review: $polished")
// ContextBank persists across all three pipes, all three nodes,
// and survives any single-node failure via P2P replication.
}
} How TPipe compares
TPipe vs LangChain, LlamaIndex, CrewAI. Framework-based runtimes handle short-horizon tasks. A single conversation, a single crew execution. They lose state and accumulate context drift beyond roughly 50 turns. The Ten Trillion Triangles TPipe is built for the long horizon. 120+ turn survival is the design target, not an edge case. Production-grade autonomous systems require it. Frameworks cannot provide it.
TPipe vs LangGraph. LangGraph handles graph-orchestrated agent flows. It does declarative topology better than pure frameworks, but it stays per-task. The graph runs, produces a result, terminates. The Ten Trillion Triangles TPipe P2P coordination, snapshot-based retry, and global ContextBank are what make the multi-day deployment possible.
When to use TPipe for long-horizon agents
- Game masters, narrative agents, and creative writing systems that need to maintain coherent state across dozens of rounds. Autogenesis, TPipeWriter.
- Research agents that gather, refine, and revise across days or weeks, with humans in the loop at pause points.
- Code-generation systems that build up a large codebase across many sessions, with state surviving every commit and every restart.
- Distributed agent clusters that need to survive individual node failures without losing the overall mission state.
- Production autonomous systems that need to operate continuously for weeks, with deterministic resource governance and crash-recovery semantics.
Frequently Asked Questions
What is a long-horizon agent?
A long-horizon agent is an autonomous system that runs for hours, days, or weeks. Long enough that context drift becomes the dominant failure mode. Most AI agents today are short-horizon: a single task, a single conversation, a single reasoning pass. The Ten Trillion Triangles TPipe is built for long-horizon deployments where the agent's state must survive every handoff, every pause, every distributed node migration.
How does TPipe keep agents running for days?
TPipe's ContextBank persists memory across sessions and distributed systems. The multi-agent primitives (Manifold, Junction, DistributionGrid) replace ad-hoc coordination with deterministic protocols. Snapshot-based state restoration in Pipelines means a crashed pipe resumes from its last known state, not from scratch. The Ten Trillion Triangles TPipe has been used to run Autogenesis game masters for 25 rounds and 120+ turns of inference without context drift. A deployment that would fail on any framework-based runtime.
What is the longest TPipe agent run on record?
Autogenesis is a headless TPipe game-master deployment. It runs 25 rounds of 5+ turns each, totaling 120+ turns of inference per session, with state surviving every handoff between reasoning pipes. The Ten Trillion Triangles TPipeWriter project has orchestrated 300-page coherent manuscript generation across thousands of generations. Both are public proof points that the substrate handles the long horizon.
How does TPipe handle context drift?
Three mechanisms. ContextBank persists only the context that is relevant: weighted lorebook injection, token-budget-aware retrieval, substring-triggered activation prune what is not. ContextBank state is global, not per-turn, so the agent does not have to rebuild its world view from a sliding window. Reasoning Pipes force the model to use the structured context rather than relying on its own weights. Context drift is the failure mode of unconstrained models. TPipe's substrate constrains the model to use what is there.
What is the difference between long-horizon and persistent-memory agents?
Persistent memory is one piece of long-horizon. A long-horizon agent also needs state-restoration on crash, deterministic coordination across distributed nodes, pause and resume for developer-in-the-loop, and snapshot-based retry propagation. The Ten Trillion Triangles TPipe bundles all of these into a single substrate. Persistent memory is necessary. The other components are what make the long horizon actually survivable.
Build long-horizon agents on the TPipe substrate
Read the architectural deep dive, see the Autogenesis case study, or jump to the docs.