跳到主要内容

Loop 0.5.0 · 2026-10-31

文档对应最新 npm 发布版本,保留英文原文。

Loop Agent

An in-memory conversation loop for Loop. The host supplies a model and stream function; Agent manages completed messages, sequential tools, subscriptions, and cancellation.

Import from index.ts. This private workspace package declares its own dependencies and public exports. It is bundled into the root @loop-harness/loop distribution.

Start

See Agent API for a minimal call and agent.sample.ts for a custom-endpoint example. Replace its example gateway URL, model ID, and capabilities, and set AGENT_EXAMPLE_API_KEY as needed before running it. The sample makes real model requests when configured and executed.

Features

Feature Documentation
Create an Agent, prompt, and reuse history Agent API
Model requests, tool turns and scheduled input boundaries Agent loop
Streaming messages and subscriptions Events
Declare, validate, and execute tools Tools
Abort, failure, truncation, and turn limits Cancellation and errors

Session storage, built-in coding tools, and model configuration belong to coding-agent. Agent has no default stream registration, persistence, queue storage, compaction, or provider implementation.

Validation

From the project root:

pnpm exec vitest run packages/agent/src
pnpm run typecheck
pnpm run check

These documents describe Loop's implemented API and its limits.