CangjieMagic:基于 Cangjie SDK 的智能 Agent 开发框架项目

基于仓颉编程语言构建的 LLM Agent 开发框架,其主要特点包括:Agent DSL、支持 MCP 协议,支持模块化调用,支持任务智能规划。

Branch12Tags0

Cangjie Magic Cangjie Lang LLM Agent

Cangjie Magic: Make Apps Grow Intelligence and Creativity


Hello Example

import magic.dsl.*
import magic.prelude.*

@ai[model: "deepseek:deepseek-chat"]
foreign func translate(text: String, targetLang: String): String

main() {
  let msg = translate("你好,Cangjie Magic!", "en")
  println(msg)
}

Install 🔨

👀 详见 docs/install.md

👀 See docs/install.md

Tutorial 📚

👀 详见 docs/tutorial.md

👀 See docs/tutorial-en.md

❓ Cangjie Magic 的各种 How-To 案例 docs/how-to.md

❓ Various How-To examples of Cangjie Magic docs/how-to.md

API Manual 📖

👀 详见 docs/api_reference.md

👀 See docs/api_reference.md

注意:API 手册由 doc_generator 自动生成,大部分情况下是正确的,但如果有不清楚的说明,请直接查看源代码

Note: The API documentation is automatically generated by doc_generator and is correct in most cases. However, if any part of the reference is unclear, please refer directly to the source code.

Examples 🚀

在目录 src/examples 下有一些示例程序:

There are some sample programs in the directory src/examples:

<name> 说明
doc_generator 为本项目生成 API 手册
Generates API documentation for this project
doc_translator 翻译项目中的中文文档
Translate Chinese documents for this project
markdown_qa 根据本项目的文档实现问答助手
Implements a Q&A assistant using this project's documentation
quick_start 快速开始程序
The quick start program
file_assistant 文件管理助手,接入开源 MCP 工具
File management assistant integrated with MCP tools
mcp_server 展示如何编写 Agent 并作为 MCP Server
Demonstrates how to write an Agent as an MCP Server
mcp_client 展示如何接入自己编写的 MCP Server
Demonstrates how to connect to a custom MCP Server

可以通过 cjpm run --name magic.examples.<name> 运行。

Run them with cjpm run --name magic.examples.<name>.

MCP Server 集合示例:https://gitcode.com/Cangjie-TPC/CangjieMagic-MCPServer

MCP Server Collection Example: https://gitcode.com/Cangjie-TPC/CangjieMagic-MCPServer

Cangjie Magic 开发者讨论群组

🤝 欢迎加入开发者讨论者群组,一起交流碰撞创意想法,构建最具创意的 Agent 应用!

🤝 Welcome to join the official developer discussion group, where we can exchange and spark creative ideas together to build the most innovative Agent applications!

Other Tutorials

大家可以在B站学习东北大学 张引 老师分享的教程 https://www.bilibili.com/video/BV1hQQzYAEHL/?spm_id_from=333.337.search-card.all.click&vd_source=ac4d1bb6a8e4a3751bba687720bd6fd9

重要变更/Import Changes

2025/8/8:

  • 增加 @tool 中 compactable 配置 Introduced the compactable config of @tool

2025/8/4:

  • 增加 @toolset 语法,能够定义工具集 Introduced the @toolset syntax, enabling the definition of toolset classes.

2025/7/8:

  • @agent 的工具配置语法变更;修改 @ai 函数语法;新语法详见 docs/tutorial.md The tool configuration syntax for @agent has been updated, and the @ai function syntax has been modified. Refer to docs/tutorial-en.md for the new syntax details.

Introduction

基于仓颉编程语言构建的 LLM Agent 开发框架,其主要特点包括:Agent DSL、支持 MCP 协议,支持模块化调用,支持任务智能规划。

Customize your domain