Coze Loop Documentation

repository·main·Indexed 26 days ago

https://github.com/coze-dev/coze-loop

A developer-oriented platform for the full lifecycle management of AI agents. Coze Loop provides a toolchain for prompt engineering with a visual editor and playground, an evaluation system for test datasets and batch experiments, and observability features including request chain tracing and performance analysis. The platform supports runtime execution via HTTP FaaS for JavaScript/TypeScript and Python, and includes specialized architecture configurations for ESLint, PostCSS, and Stylelint.

Tokens
104.1K
Snippets
244
Records
795
Agent score
89%

What's inside Coze Loop

  1. Overview of Backend DDD Business Modules

    main

    The Coze Loop backend is organized into 6 Domain-Driven Design (DDD) business modules located in backend/modules/. Each module has a specific responsibility:

    • data: Data management, including dataset CRUD and data import/export.
    • evaluation: Evaluation management, including evaluation sets, evaluators, and experiment execution.
    • foundation: Core capabilities such as users, permissions, and general configurations.
    • llm: LLM integration, including model calls and Eino framework integration.
    • observability: Observability features like Trace collection, querying, and analysis.
    • prompt: Prompt management, including Prompt CRUD, versioning, and Playground.
  2. Overview of CozeLoop

    main

    CozeLoop is a professional AI Prompt Engineering and Evaluation platform designed for developers and researchers. It provides a complete toolchain for AI application development, including prompt development, model evaluation, experiment management, and observability monitoring.

    Core Features:

    • Prompt Engineering: Visual prompt editor with templates/variables, a Playground for real-time testing, and version control.
    • Evaluation System: Management of test datasets, custom evaluators (metrics and rules), and batch experiment execution.
    • Observability: Request chain tracing, real-time performance analysis, and structured log management.
    • Tag Management: Resource classification, tag-based access control, and batch operations.
  3. Overview of Coze Loop Features

    main

    Coze Loop is a platform-level solution for AI Agent development and operations (DevOps). It provides lifecycle management capabilities including:

    • Prompt Development: Writing, debugging, optimizing, and version management via a visual Playground for real-time interaction and model comparison.
    • Evaluation: Systematic, multi-dimensional automated testing of Prompts and Agents (e.g., accuracy, conciseness, and compliance) using managed evaluation sets and experiments.
    • Observability: Full-link visualization of execution processes, capturing Prompt parsing, model calls, tool execution, and intermediate results/exceptions via SDK Trace reporting.
    • Model Support: Integration with providers like OpenAI and Volcano Ark.
  4. Backend Architecture and DDD Layers

    main

    The backend is a Go service located in backend/ with the module path github.com/coze-dev/coze-loop/backend. It follows Domain-Driven Design (DDD) principles. Each business module under modules/<domain>/ is structured as follows:

    • application/: Application services for use-case orchestration and Dependency Injection (DI) using Wire.
    • domain/: Domain models including entities, repository interfaces, and services. The domain layer must not reference the infra layer.
    • infra/: Infrastructure implementations such as repository implementations, RPC, MQ, and storage.
    • pkg/: Module-specific utilities.
    • consts/: Module constants.

    Dependency Direction: api/ $\rightarrow$ application/ $\rightarrow$ domain/ $\leftarrow$ infra/.

  5. Working with workspace dependencies

    main
    Many dependencies in apps/cozeloop/package.json use the workspace:* protocol, meaning they are maintained within this monorepo. Changes made to the source code of these workspace dependencies are applied directly to the Cozeloop project (though a re-run of the dev server may sometimes be required) because the project depends on the source code rather than compiled artifacts.
  6. Understand the Coze Loop Architecture

    main
    Coze Loop is an open-source LLM evaluation and observability platform. It uses a multi-language monorepo architecture consisting of a Go backend and a TypeScript/React frontend. The two layers communicate via a shared contract defined in Thrift IDL files located in idl/thrift/.
  7. Understand the Coze Loop frontend package structure

    main

    The frontend architecture follows a strict 6-level dependency hierarchy to maintain modularity. A critical rule is that higher-level packages can only depend on lower-level packages; reverse dependencies are prohibited.

    Dependency Hierarchy

    LevelPathDescription
    Level-6apps/cozeloop/The main SPA application (React 18, Rsbuild)
    Level-5packages/loop-pages/Page modules (auth, evaluate, observation, prompt, tag)
    Level-4packages/loop-modules/High-order business modules (e.g., evaluate/)
    Level-3packages/loop-components/UI component packages and adapters
    Level-2packages/loop-base/Core libraries (account, api-schema, hooks, stores, etc.)
    Level-1config/ & infra/Toolchain configurations and infrastructure
  8. Prompt Engineering Features Overview

    main

    The @cozeloop/prompt-pages package provides a full workflow for prompt lifecycle management:

    • Prompt List Management: Browse the prompt library, use advanced search (filter by creator, name, tags), perform batch operations (create, edit, copy, delete), and access execution traces.
    • Prompt Development: An interactive editor with version management, multi-modal support (image input), real-time testing, and integrated execution history.
    • Prompt Playground: An experimentation environment for rapid testing without saving to the library, supporting templates and model selection.
    • Observability: Integrated execution traces, performance metrics (latency, tokens), and debug information via the observation system.