BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Cloudflare Introduces Project Think: A Durable Runtime for AI Agents

Cloudflare Introduces Project Think: A Durable Runtime for AI Agents

Listen to this article -  0:00

Cloudflare has announced the preview of Project Think, a suite of primitives for its Agents SDK designed to transition AI agents from stateless orchestration into a durable, actor-based infrastructure. The release introduces a kernel-like runtime where agents survive platform restarts, manage relational memory trees, and execute self-authored code within restricted sandboxes. The kernel primitives are modelled after the success of new personal agent frameworks such as OpenClaw.

Existing enterprise frameworks, for example,  Google’s Agent Development Kit (ADK) and AWS Bedrock AgentCore, primarily utilize a request-response model. While these services manage the rehydration of session state they effectively operate on snapshots. In these architectures, the agent’s memory is an externalized KV map or JSON blob fetched from a remote store at the start of a turn. The limitation of this pattern appears during long-running tasks. If the underlying serverless compute is preempted during a complex reasoning cycle, the execution context vanishes, losing the actual progress of the logic. The framework can rehydrate the last saved snapshot, but the specific progress made during that execution window is lost, forcing the system to restart the entire operation from the last successful save.

Project Think's central innovation is the introduction of Fibers. Unlike a standard serverless function call, a fiber is a durable invocation that can checkpoint its own instruction pointer. By leveraging the runFiber primitive and ctx.stash(), developers can preserve the agent’s progress directly in an internal, co-located SQLite database.
This allows agents to handle non-deterministic, long-lived workloads that exceed traditional serverless timeouts. If a platform restart occurs while an agent is mid-loop, the runtime recovers the fiber and triggers the onFiberRecovered hook, allowing the agent to resume execution from the last checkpoint.
TypeScript

// Example: Checkpointing a multi-step research loop
export class ResearchAgent extends Agent {
  async startResearch(topic: string) {
    void this.runFiber("research", async (ctx) => {
      const findings = [];

      for (let i = 0; i < 10; i++) {
        const result = await this.callLLM(`Step ${i}: ${topic}`);
        findings.push(result);

        // Checkpoint: if evicted, the fiber resumes from here
        ctx.stash({ findings, step: i, topic });
      }
      return { findings };
    });
  }

  async onFiberRecovered(ctx) {
    if (ctx.name === "research" && ctx.snapshot) {
      const { topic, step } = ctx.snapshot;
      // Resume logic based on stashed progress
      await this.continueResearch(topic, step);
    }
  }
}

To address the security and latency challenges of tool-calling, Think allows agents to generate code and introduces graduated execution security environments. These tools run in Dynamic Workers, restricted V8 isolates spun up in milliseconds without access priveleges. This allows an agent to generate a custom extension and execute complex logic locally within the sandbox. This reduces token consumption significantly, as the model no longer needs to process raw data through the context window for every intermediate step.

Think also reimagines session persistence. While many frameworks utilize a linear history, Think’s Session API stores conversations as a relational tree. Messages are indexed with a parent_id, allowing the agent to branch and fork conversations, enabling the exploration of alternative solutions in parallel without "polluting" the primary reasoning path.

The system also provides editable Context Blocks: structured, persistent sections of the system prompt that the model can query and update. This allows the agent to proactively manage its own "learned facts" and perform non-destructive compaction of older dialogue branches.

Project Think is currently available in experimental preview for Cloudflare Workers users.

About the Author

Rate this Article

Adoption
Style

BT