CozeLoop is ByteDance's open source AI intelligences optimization platform, based on the Apache 2.0 license and free for commercial use. It focuses on the full lifecycle management of AI intelligences, covering cue word development, debugging, evaluation and operation monitoring. The platform provides visualization tools to support developers to quickly optimize the performance of intelligences and solve complex problems in development. The back-end is developed in Golang, and the front-end is based on TypeScript and React, which makes the architecture highly efficient and easy to expand.CozeLoop supports multi-language SDKs (e.g., Python, Go, JavaScript), which makes it easy to integrate with local systems. CozeLoop supports multi-language SDKs (e.g. Python, Go, Java), which makes it easy to integrate with local systems. It lowers the threshold of AI development and operation and maintenance, which is suitable for enterprises and developers to build high-performance AI applications and encourage community collaboration.
Function List
- Cue word development and debugging : through visualization Playground Real-time testing and optimization of cue words with support for multi-model comparisons.
- Automated assessment : Manage evaluation datasets and evaluators to automatically test intelligences for accuracy and compliance.
- Operation Monitoring : Record the data of the whole link of the smart body execution, and monitor the key nodes and abnormal status in real time.
- Total Life Cycle Management : Supports the complete process of intelligences from development, debugging, evaluation to deployment.
- Multi-language SDK : Provide Python, Go, JavaScript SDK, convenient for secondary development and system integration.
- model integration : Support for large models such as OpenAI, Volcano Engine Ark, and other flexible configurations.
- Open Source Community Support : Based on the Apache 2.0 license, community contributions of code and feedback are encouraged.
- Internationalization Support : Support for multi-language interfaces, adapted to the needs of global developers.
Using Help
Installation and Deployment
CozeLoop is an open source project, you need to clone the code from the GitHub repository and deploy it locally. Here are the detailed steps:
- environmental preparation ::
- hardware requirement : Minimum 2-core CPU, 4GB RAM.
- software dependency ::
- Docker and Docker Compose : Ensure that the Docker service is installed and started.
- Golang : Recommended version 1.23.4, configure environment variables.
- Node.js : Recommended LTS version for JavaScript SDK development.
- pnpm : Install pnpm globally (recommended version 9.12.0):
npm i -g pnpm@9.12.0
- clone warehouse ::
Get the CozeLoop source code:
git clone https://github.com/coze-dev/cozeloop.git
cd cozeloop
- Configuring Environment Variables ::
- interviews
https://loop.coze.cn/console/enterprise/personal/open/oauth/apps
Create an OAuth application to get theclient_id
,public_key_id
cap (a poem)private_key
The - establish
.env
file, configure the following:COZELOOP_WORKSPACE_ID=your_workspace_id COZELOOP_JWT_OAUTH_CLIENT_ID=your_client_id COZELOOP_JWT_OAUTH_PRIVATE_KEY=your_private_key COZELOOP_JWT_OAUTH_PUBLIC_KEY_ID=your_public_key_id COZELOOP_API_BASE=https://api.coze.cn
- interviews
- configuration model ::
- Copy the model profile template (e.g. Volcano Engine Ark model):
cp conf/model/template/model_template_ark.yaml conf/model/ark.yaml
- compiler
conf/model/ark.yaml
, configure the following fields:id
: Custom model IDs, non-zero integers, globally unique, not modifiable after deployment.meta.conn_config.api_key
: Model Service API Key, e.g., Volcano Engine Ark API Key (for how to get it seehttps://www.volcengine.com/docs/82379/1541594
).meta.conn_config.model
: Model Endpoint ID, e.g., Endpoint ID of the Ark model (see Getting the Endpoint ID of a Model).https://www.volcengine.com/docs/82379/1099522
).
- Copy the model profile template (e.g. Volcano Engine Ark model):
- Installation of dependencies ::
- Go dependencies are passed through the
go mod
Automated management:go mod tidy
- JavaScript dependencies:
pnpm install rush update
- Go dependencies are passed through the
- Build and Run ::
- Build project:
go build
- Start the service:
docker compose --profile '*' up -d
The first deployment may require pulling the image, and the logs will show after a successful startup.
Container coze-server Started
Byhttp://localhost:3000
Access.
- Build project:
- development model ::
- The default development mode supports hot reloading, modifying the backend code without restarting the service. Run:
./dev_reload.sh
- The default development mode supports hot reloading, modifying the backend code without restarting the service. Run:
Using the Core Functions
1. Cue development and debugging
- Go to Playground : Login Console (
https://loop.coze.cn/console/enterprise/personal/open
), select the "Prompt Words" module. - Creating Prompts : Input the content of the cue words and test the output effect in real time. Support multi-model comparison (e.g. OpenAI and Ark model). Sample Go code:
prompt, err := loop.GetPrompt(ctx, loop.GetPromptParam{PromptKey: "test_prompt"})
messages, err := loop.PromptFormat(ctx, prompt, map[string]any{"input": "Hello"})
- version management : Save the cue word version and switch or roll it back at any time.
2. Automated assessments
- Management assessment set : Upload test datasets (e.g., JSON files), define evaluation metrics (e.g., accuracy, conciseness).
- running experiment : Select the evaluator, automatically test the smart body output, and view the statistics.
- View Report : The console displays experiment reports and analyzes model performance.
3. Operational monitoring
- Trace : Record data from the full chain of intelligences execution, including input parsing, model invocation, and output. go example:
ctx, span := loop.StartSpan(ctx, "root", "custom")
span.SetInput(ctx, "User query")
span.SetOutput(ctx, "AI response")
span.Finish(ctx)
loop.Close(ctx)
- visualization : View Trace data on the console to analyze critical nodes and exception status.
4. SDK integration
- Python SDK : For quick integration:
from cozepy import Coze, TokenAuth
coze = Coze(auth=TokenAuth(os.getenv("COZE_API_TOKEN")))
bot = coze.bots.create(space_id="your_workspace_id", name="TestBot")
print(f"Created bot: {bot.name}")
- JavaScript SDK : in
frontend
directory to run:
rushx start
5. Internationalization support
- Configure the multilingual interface in
conf
Catalog Edit i18n Settings, support English, Simplified Chinese, etc.
problem screening
- Check Configuration : To ensure that
.env
and model profiles are correct. - View Log : Run the following command to check the container status:
docker ps
docker logs <container_id>
- network problem : Acknowledgement
COZELOOP_API_BASE
accessible, check the Docker network.
Community Contributions
- consultation
CONTRIBUTING.md
Submit Code. Security issues are addressed through thehttps://security.bytedance.com/src
or e-mailsec@bytedance.com
Report, do not disclose.
application scenario
- AI Customer Service Optimization
Use CozeLoop debugging prompt words to monitor customer service intelligences performance and improve response accuracy. - Model Evaluation
Developers test the model output through the automated evaluation module to optimize the effectiveness of AI applications. - real time monitoring
Enterprises monitor the operating status of intelligences, quickly find and fix abnormalities, and improve system stability. - multilingual application
Develop global AI applications and adapt to multilingual users with i18n support.
QA
- What is the difference between CozeLoop and Coze Studio?
CozeLoop focuses on cue word debugging, evaluation and monitoring to optimize smartbody performance; Coze Studio focuses on smartbody development and workflow orchestration. - How do I get the OAuth parameters?
interviewshttps://loop.coze.cn/console/enterprise/personal/open/oauth/apps
If you want to create an OAuth application, create an OAuth application and get the key. - What models are supported?
Supports models such as OpenAI, Volcano Engine Ark, etc., which need to be configured manually.https://github.com/coze-dev/cozeloop/wiki/5.-Model-configuration
The - Is programming experience required?
The console supports no-code operation, and programming users can customize features via the SDK. - How do I join the community?
Scanning with Flying BookREADME.md
Join the CozeLoop technical exchange group.