Maximum Size for Resource Files Associated with Skills in TencentDB Agent Memory
The maximum size for resource files associated with Skills in TencentDB Agent Memory is 1 MiB (1,048,576 bytes), which represents the total allowed size of the JSON request body including both the Skill content and all embedded resource files.
In the TencentCloud/TencentDB-Agent-Memory repository, the asset import pipeline enforces this hard limit to ensure reliable gateway transmission. When creating or updating Skills, the system aggregates all associated data—including metadata, content, and resource files—into a single JSON payload that must not exceed this threshold, or the upload is aborted entirely.
How the 1 MiB Limit Is Enforced in uploadSkill
The size constraint is implemented in agents/asset-import.ts within the uploadSkill function (lines 1106–1115). Before transmitting data to the gateway, the code calculates the serialized byte length of the complete Skill creation body and compares it against the constant GATEWAY_MAX_BODY_BYTES.
The Body Construction and Size Calculation
The helper function buildSkillCreateBody assembles the request payload by combining the Skill’s frontmatter name, content, team ID, and any associated resources into a single JSON object. Each resource file is embedded in the resources array with its path, content, and encoding details.
// Helper that builds the request body for a Skill, including its resources
function buildSkillCreateBody(ctx: WriteCtx, skill: ScannedSkill) {
const name = parseFrontmatterName(skill.content) || skill.name;
const body: Record<string, unknown> = {
name,
content: skill.content,
team_id: ctx.teamId,
agent_id: resolveSkillAgentId(ctx),
};
if (skill.resources.length > 0) {
body.resources = skill.resources.map(r => ({
path: r.path,
content: r.content,
encoding: 'utf-8',
}));
}
return { name, body };
}
The utility function skillCreateBodyBytes then computes the exact byte length of this serialized JSON structure, which includes the UTF-8 encoded content of all resource files.
The Hard Limit Verification
Inside uploadSkill, the system performs a strict bounds check. If the calculated size exceeds GATEWAY_MAX_BODY_BYTES (1 MiB), the function returns an oversized result immediately without sending the HTTP request to the gateway endpoint.
// Size check – aborts if > 1 MiB (GATEWAY_MAX_BODY_BYTES)
export async function uploadSkill(
client: PanelClient,
ctx: WriteCtx,
skill: ScannedSkill,
): Promise<UploadSkillResult> {
const { name: skillName, body } = buildSkillCreateBody(ctx, skill);
const bytes = skillCreateBodyBytes(body); // calculates JSON byte length
if (bytes > GATEWAY_MAX_BODY_BYTES) { // 1 MiB limit
return { oversized: { name: skillName, bytes } }; // Skill is skipped
}
// …otherwise send to the gateway
const env = await client.post('/skill/create', body);
// ...
}
According to the inline comments at line 1106, the logic specifically states that if the body exceeds 1 MB, the system should "整条跳过、不请求" (skip the entire entry and do not send the request).
Consequences of Exceeding the Size Limit
When a Skill’s combined payload—including its main content and all entries in the resources array—exceeds 1 MiB, the upload process terminates before network transmission occurs. This means:
- No partial uploads: The system does not truncate, compress, or split oversized Skills.
- Gateway exclusion: The Skill will not be registered or available in the TencentDB Agent Memory gateway.
- Silent failure: The
uploadSkillfunction returns anoversizedstatus object containing the Skill name and byte count, allowing the calling code to log or handle the rejection.
Working with Resource Files Under the Limit
Resource files are embedded as base64 or UTF-8 text within the resources array property of the JSON body. To ensure successful uploads:
- Aggregate size monitoring: Remember that the 1 MiB limit applies to the total serialized JSON, including both the Skill’s
contentfield and all resource file contents—not just individual file sizes. - Pre-upload validation: Use the
skillCreateBodyBytesutility to validate payload size before attempting an upload, preventing unnecessary network overhead.
Summary
- 1 MiB total limit: The
GATEWAY_MAX_BODY_BYTESconstant inagents/asset-import.tssets a hard ceiling of 1,048,576 bytes for the entire Skill creation request body. - Inclusive calculation: The limit accounts for the Skill definition metadata, main content, and all embedded resource files combined.
- Strict enforcement: The
uploadSkillfunction aborts any request exceeding this size, returning anoversizedstatus instead of sending data to the gateway. - Source location: Implementation details are found in
agents/asset-import.ts(lines 1106–1115), with supporting documentation inMemoryCore/SKILL.md.
Frequently Asked Questions
What is the exact byte limit for Skill resource files in TencentDB Agent Memory?
The exact limit is 1,048,576 bytes (1 MiB), defined by the GATEWAY_MAX_BODY_BYTES constant in the asset import utility. This represents the maximum serialized JSON size allowed for any Skill creation request.
Does the 1 MiB limit apply to individual resource files or the total request?
The limit applies to the total request body size. When you attach resource files to a Skill, their combined UTF-8 encoded content—plus the Skill's main content and metadata—must fit within 1 MiB. Individual files are not checked separately; only the aggregate serialized JSON size matters.
What happens if my Skill with resources exceeds the 1 MiB limit?
The uploadSkill function will skip the upload entirely and return an oversized result containing the Skill name and byte count. The request will not reach the gateway, and the Skill will not be created or updated in the system.
Where in the codebase is the size limit enforced?
The enforcement logic resides in agents/asset-import.ts within the uploadSkill async function, specifically between lines 1106 and 1115. This section calculates the body size using skillCreateBodyBytes and compares it against GATEWAY_MAX_BODY_BYTES before calling client.post('/skill/create', body).
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →