跳到正文
Skillpedia
智能体6.3k · #14378

PuerTS Agent Development Guide

它能做什么

这项技能是在 Unity 中使用 PuerTsAgent 框架构建 AI 智能体的指南。适合希望在 Unity 项目中运行 LLM 智能体的游戏和应用开发者。

适用场景

  • ✓当你想使用 PuerTS 在 Unity 项目中创建 LLM 智能体时。
  • ✓当你需要为智能体设置系统提示词、技能或内置模块时。
  • ✓当你在构建智能体之前想确认所需的 PuerTS 包已安装时。

技能链接

https://github.com/Tencent/puerts/blob/master/unity/skills/puerts-agent-development/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/Tencent/puerts/blob/master/unity/skills/puerts-agent-development/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我在 Unity 项目中创建一个帮助玩家的 LLM 智能体,并为它设置自己的系统提示词和技能。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能会先检查所需的 PuerTS 包是否已安装,然后询问智能体文件应放在 Unity Resources 文件夹的哪个位置。接着,它会指导你完成提示词、技能和内置模块的设置,以及内置模块的语言选择。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

PuerTS Agent Development Guide

This skill provides the complete guide for developing LLM agents based on the PuerTsAgent framework.

⚠️ Important — Required Packages: This framework depends on PuerTS core, v8, and agent packages. Before proceeding, you must check the Unity project's Packages/manifest.json to verify that the following packages are installed:

  • com.tencent.puerts.core
  • com.tencent.puerts.v8
  • com.tencent.puerts.agent

If any of these packages are missing, they must be installed first before using this skill. you MUST first invoke the "Install PuerTS for Unity" skill to AUTO complete the setup.

⚠️ Prerequisite: Before using this skill to create or modify an agent, you must know the agent's resource directory path under Unity Resources/ (e.g., maze-runner, editor-assistant). If the user has not provided this path, ask the user which Resources/ subdirectory to use before proceeding. All agent files (system-prompt, skills, builtins) are organized under this path.

⚠️ Builtin Language Choice: When creating builtin modules, you must ask the user whether they want to write builtins in TypeScript or JavaScript:

  • TypeScript → Create a dedicated TS project (with package.json, tsconfig.json, esbuild.mjs) whose build output (outdir) points to Assets/Resources/<agent-name>/builtins/. See TypeScript Project Setup for Builtins section below.
  • JavaScript → Write .mjs files directly in Assets/Resources/<agent-name>/builtins/.

Overview

In this framework, an agent's behavior and capabilities are entirely defined by files in a resource directory (Resource Root). Different resource directories represent different agents — Unity editor assistants, in-game AI characters, or any role you need.

Key Concept: Both system-prompt.md.txt and files under skills/ are essentially prompts (natural language instructions for the LLM). The only difference is their loading strategy:

  • system-prompt.md.txt — Always present in context (persistent). Put prompts here that are needed for most tasks.
  • skills/*.md.txt — Loaded on demand by the LLM via loadSkill. Put prompts here that are not needed for every task — they are loaded only when the LLM determines they are relevant.

Creating an Agent

Initialize an agent in C# via its resource path:

var agent = new AgentScriptManager();
agent.Initialize("maze-runner", () =>
{
    Debug.Log("Maze runner agent is ready!");
});

The first parameter of Initialize is the resource directory path under Unity Resources/. The framework loads the full agent definition from this directory:

  • system-prompt.md.txt — Role definition (System Prompt)
  • skills/ — Domain skill documents (loaded on demand, optional)
  • builtins/ — Built-in helper modules (executable JS modules)

Example Directory Structure

Resources/maze-runner/
├── system-prompt.md.txt          # Role definition (System Prompt)
├── skills/                       # Domain skills (loaded on demand, optional)
└── builtins/                     # Built-in modules (loaded on demand)
    ├── maze-control.mjs          # Maze movement and status query
    └── screenshot.mjs            # Screenshot to observe the maze

All resource files are placed in Unity's Resources/ directory.

File extension convention: Unity Resources does not support .md and .mjs as TextAsset, so:

  • Markdown files use .md.txt suffix
  • JS module files use .mjs suffix

1. System Prompt — Role Definition

Purpose

system-prompt.md.txt defines the agent's identity, personality, capabilities, and behavioral rules. It is injected at the beginning of the LLM's system prompt and is the core of the agent's "persona."

This is a persistent prompt — it is always present in the LLM's context for every conversation turn. Therefore, put only the most frequently used instructions here — things the agent needs for the majority of its tasks. Avoid stuffing rarely-used domain knowledge here, as it permanently consumes context tokens.

File Location

<resource-root>/system-prompt.md.txt

Format

Plain text / Markdown format, write role definition directly, no front-matter needed.

Example — Editor A

常见问题

它需要哪些包?

需要 Unity 项目中的 PuerTS 核心、v8 和 agent 包。

我可以用 TypeScript 编写内置模块吗?

可以。技能会询问内置模块使用 TypeScript 还是 JavaScript。

智能体文件放在哪里?

它们放在你选择的 Unity Resources 目录下的一个文件夹中。

详情

作者的原始描述

Guide for developing LLM agents based on PuerTsAgent framework — covers resource directory structure, system-prompt, skills, builtin modules, and best practices.

repo: Tencent/puerts

热度

GitHub 星标
6.3k
排名
#14378
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能