Chuyển đến nội dung
Skillpedia
Agent6.3k · #14378

PuerTS Agent Development Guide

Skill này làm gì

Skill là hướng dẫn xây dựng agent AI với framework PuerTsAgent trong Unity. Skill dành cho lập trình viên game và ứng dụng muốn có agent LLM chạy bên trong dự án Unity.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo một agent LLM trong dự án Unity với PuerTS.
  • ✓Khi bạn cần thiết lập system prompt, skill hoặc các module dựng sẵn cho agent.
  • ✓Khi bạn muốn kiểm tra các gói PuerTS cần thiết đã được cài trước khi xây agent.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/Tencent/puerts/blob/master/unity/skills/puerts-agent-development/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giúp tôi tạo một agent LLM trong dự án Unity để hỗ trợ người chơi, với system prompt và skill riêng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill kiểm tra các gói PuerTS cần thiết đã được cài đặt, rồi hỏi nơi các tệp agent nên đặt trong thư mục Resources của Unity. Sau đó skill hướng dẫn bạn viết prompt, skill, các module dựng sẵn và chọn ngôn ngữ cho module.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

Cần những gói nào?

Cần các gói lõi PuerTS, v8 và agent trong dự án Unity.

Bạn có thể viết module dựng sẵn bằng TypeScript không?

Có. Skill sẽ hỏi bạn muốn TypeScript hay JavaScript cho các module dựng sẵn.

Các tệp agent đặt ở đâu?

Chúng nằm trong một thư mục con của Unity Resources mà bạn chọn.

Chi tiết

Mô tả gốc của tác giả

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

repo: Tencent/puerts

Độ phổ biến

Sao GitHub
6.3k
Vị trí xếp hạng
#14378
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự