AGENTCONN
L

// Agent profile

LoopForge

Coding Free

About LoopForge

LoopForge (Tencent/LoopForge, 5.6K GitHub stars) is an open-source framework from Tencent for orchestrating the control flow of AI agent workflows. Rather than writing custom retry logic, branching conditions, and error recovery for every agent pipeline, LoopForge provides composable loop primitives — retry with backoff, conditional branching, parallel fan-out/fan-in, state machines, and circuit breakers — as building blocks that snap together. The core insight: most agent failures aren't model failures, they're loop failures. The model gave a good answer but the orchestration didn't retry on a transient API error, didn't branch on an unexpected output format, or didn't checkpoint state before a long-running step. LoopForge makes these patterns first-class, declarative, and testable.

Key Features

  • Composable loop primitives — retry, branch, fan-out/fan-in, state machine, circuit breaker
  • Declarative workflow definition — YAML or Python DSL for multi-step agent pipelines
  • Built-in retry with configurable backoff — exponential, linear, jitter strategies
  • State checkpointing — resume long-running workflows from the last successful step
  • Conditional branching — route agent outputs through different paths based on content or status
  • Parallel execution — fan-out to multiple agents or tools, fan-in with aggregation
  • Circuit breaker pattern — prevent cascading failures in multi-service agent chains
  • Observable loops — structured logging and tracing for every loop iteration

Overview

LoopForge tackles the unglamorous but critical layer of agent engineering: what happens between model calls. When an agent pipeline fails in production, the culprit is rarely the model itself — it’s the orchestration around it. A transient API timeout with no retry. A tool call that returned an unexpected format with no fallback. A multi-step workflow that crashed at step 7 of 10 with no way to resume. LoopForge, built by Tencent’s AI infrastructure team, provides composable primitives for these patterns so developers stop reimplementing them from scratch.

The framework treats loops as first-class abstractions. A retry loop, a conditional branch, a parallel fan-out, and a state machine are all loop types that compose together. You define your agent workflow as a graph of loop primitives, each with its own configuration (retry count, backoff strategy, branch conditions, checkpoint behavior), and LoopForge handles execution, error recovery, and observability.

Key Capabilities

Retry with strategy: Not all retries are equal. LoopForge supports exponential backoff, linear backoff, jitter, and custom strategies. Retries can be scoped to specific error types (transient vs. permanent) and configured per-step, not globally. A flaky API call gets aggressive retries; a rate-limited endpoint gets slow backoff with jitter.

State checkpointing: Long-running agent workflows can checkpoint their state at any step. When a failure occurs at step 7, the workflow resumes from step 7 — not step 1. Checkpoints are pluggable (local disk, Redis, S3) and versioned so workflow schema changes don’t corrupt saved state.

Conditional branching: Agent outputs aren’t always predictable. LoopForge lets you define branch conditions that inspect model output, tool results, or accumulated state and route execution through different paths. When a code review agent flags a security issue, the workflow branches to a security-focused review path rather than continuing the standard flow.

Parallel fan-out/fan-in: Dispatch the same task to multiple agents or tools in parallel, then aggregate results. Useful for ensemble approaches (ask three models, take the majority), competitive evaluation (benchmark three tools, pick the fastest), or independent subtask execution.

Use Cases

Teams building production agent pipelines that need reliability beyond demo quality. Multi-step workflows where any step can fail and the whole pipeline shouldn’t restart. Agent orchestration systems that coordinate multiple models or tools with different reliability profiles. CI/CD-style agent pipelines where loop behavior needs to be tested and versioned alongside the agent code.

Considerations

LoopForge adds a layer of abstraction over direct agent calls. For simple single-model workflows with no error recovery needs, it’s overhead. The framework shines when workflows have 5+ steps, multiple failure modes, or need to resume after crashes. The YAML workflow definition has a learning curve — the Python DSL is more intuitive for developers who prefer code over configuration.

Similar Agents