Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(platform): increase skill description limit to 1,024 chars (#14024)

Toran Bruce Richards3b0ffe0b6274
diff --git a/autogpt_platform/backend/backend/copilot/tools/skills.py b/autogpt_platform/backend/backend/copilot/tools/skills.py
index a13179eaa9..dfae082bb0 100644
--- a/autogpt_platform/backend/backend/copilot/tools/skills.py
+++ b/autogpt_platform/backend/backend/copilot/tools/skills.py
@@ -51,15 +51,15 @@ logger = logging.getLogger(__name__)
# Limits — keep the per-turn <available_skills> index small enough that it
# does not strain Anthropic prompt caches and does not crowd out the user's
# turn budget. A typical user skill line lands around 150-200 chars
-# (~50 tok), so 50 entries ≈ 2.5k tokens. The hard worst case — every
-# description and every trigger filled to the per-field caps below — is
-# ~12k tokens, used as the upper bound when sizing the prefix cache.
+# (~50 tok), so 50 entries ≈ 2.5k tokens. Filling every description and
+# trigger to the per-field caps below is roughly 22k tokens under the same
+# estimate; actual token cost varies by content and tokenizer.
# Built-in seeded skills are tiny so first-touch users see well under
# 200 tokens of overhead.
# ---------------------------------------------------------------------------
MAX_USER_SKILLS = 50
MAX_NAME_CHARS = 64
-MAX_DESCRIPTION_CHARS = 250
+MAX_DESCRIPTION_CHARS = 1024
MAX_BODY_CHARS = 20_000
# Triggers appear inline in the per-turn ``<available_skills>`` index,
# so an unbounded list (or one huge trigger) would balloon the prefix
diff --git a/autogpt_platform/backend/backend/copilot/tools/skills_test.py b/autogpt_platform/backend/backend/copilot/tools/skills_test.py
index 5cb10cd583..3d2a425107 100644
--- a/autogpt_platform/backend/backend/copilot/tools/skills_test.py
+++ b/autogpt_platform/backend/backend/copilot/tools/skills_test.py
@@ -179,7 +179,7 @@ def test_description_length_cap_enforced_by_validate_path():
"""The cap is enforced inside ``StoreSkillTool._execute`` (not by
the dataclass), so this test just locks in the constant — bumping
it requires conscious thought about per-turn token cost."""
- assert MAX_DESCRIPTION_CHARS == 250
+ assert MAX_DESCRIPTION_CHARS == 1024
def test_trigger_caps_are_bounded():
@@ -345,7 +345,32 @@ async def test_store_skill_rejects_oversized_description():
body="ok",
)
assert isinstance(result, ErrorResponse)
- assert "description" in result.message
+ assert (
+ f"{MAX_DESCRIPTION_CHARS + 1}/{MAX_DESCRIPTION_CHARS} chars" in result.message
+ )
+ assert "trim 1" in result.message
+
+
+async def test_store_skill_accepts_description_at_limit():
+ tool = StoreSkillTool()
+ fake_manager = _FakeWorkspaceManager()
+ description = "x" * (MAX_DESCRIPTION_CHARS - 1) + "😀"
+
+ with _patch_skills_path(fake_manager):
+ result = await tool._execute(
+ user_id="user-1",
+ session=_make_session(),
+ name="foo",
+ description=description,
+ body="ok",
+ )
+
+ assert isinstance(result, StoreSkillResponse)
+ stored = fake_manager.files["/skills/foo/SKILL.md"].decode()
+ parsed = parse_skill_markdown(stored)
+ assert parsed is not None
+ assert parsed.description == description
@pytest.mark.asyncio
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/skills/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/library/skills/__tests__/main.test.tsx
index 752f927c46..ad5ddd712f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/skills/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/library/skills/__tests__/main.test.tsx
@@ -299,7 +299,7 @@ describe("SkillsPage", () => {
await screen.findByTestId("skills-empty");
const input = screen.getByTestId("skill-upload-input");
- const longDescription = "x".repeat(251);
+ const longDescription = "x".repeat(1025);
const file = new File(
[`---\nname: too_long\ndescription: ${longDescription}\n---\n\nbody`],
"too_long.md",
@@ -311,7 +311,7 @@ describe("SkillsPage", () => {
expect(toastMock).toHaveBeenCalledWith(
expect.objectContaining({
title: "Can't upload this skill",
- description: expect.stringContaining("251/250"),
+ description: expect.stringContaining("1025/1024"),
variant: "destructive",
}),
);
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/__tests__/getSkillUploadError.test.ts b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/__tests__/getSkillUploadError.test.ts
index 7186e19750..6259510143 100644
--- a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/__tests__/getSkillUploadError.test.ts
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/__tests__/getSkillUploadError.test.ts
@@ -18,6 +18,7 @@ describe("getSkillUploadError", () => {
});
test("reports the exact length when description is too long", () => {
+ expect(MAX_SKILL_DESCRIPTION_CHARS).toBe(1024);
const desc = "x".repeat(MAX_SKILL_DESCRIPTION_CHARS + 1);
const err = getSkillUploadError(md(`name: ok_skill\ndescription: ${desc}`));
expect(err).toContain(
@@ -33,6 +34,25 @@ describe("getSkillUploadError", () => {
).toBeNull();
});
+ test("counts non-BMP characters the same way as the backend", () => {
+ const desc = `${"x".repeat(MAX_SKILL_DESCRIPTION_CHARS - 1)}😀`;
+
+ expect(desc.length).toBe(MAX_SKILL_DESCRIPTION_CHARS + 1);
+ expect(
+ getSkillUploadError(md(`name: ok_skill\ndescription: ${desc}`)),
+ ).toBeNull();
+ });
+
+ test("reports an over-limit Unicode code-point count", () => {
+ const desc = `${"x".repeat(MAX_SKILL_DESCRIPTION_CHARS)}😀`;
+ const err = getSkillUploadError(md(`name: ok_skill\ndescription: ${desc}`));
+
+ expect(err).toContain(
+ `${MAX_SKILL_DESCRIPTION_CHARS + 1}/${MAX_SKILL_DESCRIPTION_CHARS}`,
+ );
+ expect(err).toContain("trim at least 1");
+ });
+
test("strips surrounding quotes before measuring", () => {
const desc = "x".repeat(MAX_SKILL_DESCRIPTION_CHARS);
expect(
@@ -50,6 +70,15 @@ describe("getSkillUploadError", () => {
expect(getSkillUploadError(md(`name: ok_skill\n${line}`))).toBeNull();
});
+ test("does not false-reject YAML-only escapes it cannot decode", () => {
+ const escapedEmoji = "\\U0001F600".repeat(103);
+
+ expect(escapedEmoji.length).toBe(1030);
+ expect(
+ getSkillUploadError(md(`name: ok_skill\ndescription: "${escapedEmoji}"`)),
+ ).toBeNull();
+ });
+
test("does not false-reject a block-scalar description it cannot measure", () => {
const block = `name: ok_skill\ndescription: |\n ${"x".repeat(300)}`;
// Block scalar is unmeasurable from one line — defer to the backend.
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/helpers.ts b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/helpers.ts
index 8b7f4539bc..ce112c3d89 100644
--- a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/helpers.ts
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/UploadSkillButton/helpers.ts
@@ -1,7 +1,7 @@
// Mirrors backend limits in backend/copilot/tools/skills.py — kept in sync
// manually. These bound the per-turn `<available_skills>` index the copilot
// sees, so the cap is deliberate (see backend MAX_DESCRIPTION_CHARS).
-export const MAX_SKILL_DESCRIPTION_CHARS = 250;
+export const MAX_SKILL_DESCRIPTION_CHARS = 1024;
const FRONTMATTER_RE = /^---\n([\s\S]*?)\n---/;
@@ -28,9 +28,15 @@ export function getSkillUploadError(content: string): string | null {
return "File is not a valid SKILL.md — frontmatter must include a non-empty name and description.";
}
- if (description && description.length > MAX_SKILL_DESCRIPTION_CHARS) {
- const over = description.length - MAX_SKILL_DESCRIPTION_CHARS;
- return `Description is ${description.length}/${MAX_SKILL_DESCRIPTION_CHARS} characters — trim at least ${over}. It appears in the copilot's per-turn skills index, so it's kept short.`;
+ const descriptionLength = description
+ ? Array.from(description).length
+ : undefined;
+ if (
+ descriptionLength !== undefined &&
+ descriptionLength > MAX_SKILL_DESCRIPTION_CHARS
+ ) {
+ const over = descriptionLength - MAX_SKILL_DESCRIPTION_CHARS;
+ return `Description is ${descriptionLength}/${MAX_SKILL_DESCRIPTION_CHARS} characters — trim at least ${over}. It appears in the copilot's per-turn skills index, so it's kept short.`;
}
return null;
@@ -64,7 +70,10 @@ function readScalarField(frontmatter: string, key: string): string | undefined {
try {
return JSON.parse(raw);
} catch {
- return raw.slice(1, -1);
+ // YAML supports escape sequences that JSON does not (for example,
+ // `\U0001F600`). If we cannot decode the scalar confidently, defer its
+ // validation to the backend instead of measuring the encoded text.
+ return undefined;
}
}
// Single-quoted YAML escapes a quote by doubling it (`''`).