Upload a skill package
You can upload a skill package when you create a skill record, and replace or remove it later. The registry validates the package after the request returns, stores it, and copies its SKILL.md into the record’s skillMd.data.
Before you upload a package, make sure of the following:
-
The package follows the rules in Skill package format and validation and is no larger than the maximum package size in Skill package limits (5 MiB of ZIP data, before base64 encoding).
-
You have
agent-registry:CreateRegistryRecordon the registry, oragent-registry:UpdateRegistryRecordon the record. If the registry is encrypted with a customer managed key, you also needkms:GenerateDataKeyandkms:Decrypton the key. The registry checks that you can use the key before it accepts the package. For more information, see Set customer managed key policy and IAM Permissions.
Create a skill record with a package
Console
-
Open the registry detail page in the AWS Agent Registry console
. -
In the Registry records section, choose Create record.
-
In the Record source section, choose Define manually.
-
In the Record details section, enter a Name for the record.
-
For Type, choose Skills. For Descriptor, choose Agent skills definition.
-
(Optional) Expand Additional configuration, and enter a Display name, a Description, and a Record version.
-
In the Skill content section, for Skill content source, choose Upload a package.
-
For Additional content, choose Skill definition to add a structured skill definition in JSON, or None. The package supplies SKILL.md, so the editor for it isn’t offered on this path.
-
For Skill package, choose your .zip file, or drag and drop it onto the page.
The console accepts a single .zip file of up to 5 MiB. Before you submit, it checks that the file has the .zip extension, that it’s a readable ZIP archive, and that it’s within the size limit. If you choose another file, it replaces the one that you chose.
-
(Optional) For SHA-256 checksum, enter the package’s SHA-256 checksum as 64 hexadecimal characters. The registry rejects the package if it doesn’t match. If you leave it blank, the registry still computes and stores its own checksum.
-
(Optional) In the Tags section, add tags to the record.
-
Choose Create as draft, or Create and submit for approval.
The record is in CREATING status while the registry validates the package. When validation finishes, the record moves to DRAFT, or to CREATE_FAILED. To see the problems, choose the record’s Status in the Record details section of the record detail page. If you chose Create and submit for approval, the console submits the record if validation finishes within about 30 seconds. Otherwise, wait for the record to reach DRAFT status, and then submit it for approval.
AWS CLI
In the AWS CLI, artifact.content is base64 text inside the request JSON. Pass the request with --cli-input-json, because a package is usually too large for a command-line argument. The optional sha256 is the lowercase hexadecimal SHA-256 checksum of the ZIP file itself, not of its base64 text.
These examples use the AWS CLI version 2 default binary format, base64. If your CLI configuration sets cli_binary_format to raw-in-base64-out, add --cli-binary-format base64 to the command, so that the CLI doesn’t encode the content a second time.
The following commands encode the package, write the request with jq, and create the record:
# Checksum of the ZIP file, as lowercase hexadecimal SHA256=$(sha256sum my-skill.zip | cut -d ' ' -f 1) # Base64-encode the ZIP file, without line breaks base64 -w 0 my-skill.zip > my-skill.zip.b64 jq -n \ --arg registryId "<registryId>" \ --rawfile content my-skill.zip.b64 \ --arg sha256 "$SHA256" \ '{ registryId: $registryId, name: "my-skill", recordType: "SKILL", recordVersion: "1.0", descriptors: {agentSkillsDefinition: {}}, artifact: {content: $content, sha256: $sha256} }' > create-skill-record.json aws agent-registry-control create-registry-record \ --cli-input-json file://create-skill-record.json \ --region us-east-1
On macOS, use shasum -a 256 my-skill.zip for the checksum and base64 -i my-skill.zip -o my-skill.zip.b64 to encode the file.
The response returns the record’s ARN and its status:
{ "recordArn": "arn:aws:agent-registry:us-east-1:111122223333:registry/AbCdEfGh1234/record/Rec123456789", "status": "CREATING" }
To add a skill definition, set agentSkillsDefinition to {"data": "<skill definition JSON>", "dataSchemaVersion": "0.1.0"} instead of {}. Don’t send skillMd.data, because the registry sets it from the package.
To see the result of validation, get the record until its status is no longer CREATING:
aws agent-registry-control get-registry-record \ --registry-id <registryId> \ --record-id <recordId> \ --query '{status: status, statusReason: statusReason}' \ --region us-east-1
AWS SDK
The AWS SDKs take the package as bytes and encode it for you. The following example uses the AWS SDK for Python (Boto3):
import hashlib import time import boto3 client = boto3.client('agent-registry-control') with open('my-skill.zip', 'rb') as f: package = f.read() response = client.create_registry_record( registryId='<registryId>', name='my-skill', recordType='SKILL', recordVersion='1.0', descriptors={'agentSkillsDefinition': {}}, artifact={ 'content': package, # the ZIP bytes 'sha256': hashlib.sha256(package).hexdigest(), # optional }, ) record_arn = response['recordArn'] print(f"Status: {response['status']}") # CREATING # Wait for validation to finish while True: record = client.get_registry_record(registryId='<registryId>', recordId=record_arn) if record['status'] not in ('CREATING', 'UPDATING'): break time.sleep(5) print(record['status'], record.get('statusReason', ''))
What happens after you upload
CreateRegistryRecord and UpdateRegistryRecord return as soon as the registry receives the package. Validation runs after the request returns:
-
On create, the record moves from
CREATINGtoDRAFT, or toCREATE_FAILED. -
On update, the record moves from
UPDATINGtoDRAFT, or toUPDATE_FAILED. If the update fails,GetRegistryRecordkeeps returning a download URL for the last uploaded package that passed validation. If the upload replaced a synchronized package,GetRegistryRecordreturns no download URL until an update succeeds. For more information, see Packages during an update.
If validation fails, statusReason lists the problems. For information about how to read it, see How validation failures appear. To fix a CREATE_FAILED or UPDATE_FAILED record, upload a corrected package with UpdateRegistryRecord.
While the record is in CREATING or UPDATING status, you can’t update or delete it. A request to do so fails with a ConflictException.
Replace the package
When you replace the package of an APPROVED record, the update creates a new DRAFT revision, even if the new package has the same bytes. Discovery keeps returning the approved package until you submit the new revision and it’s approved. For more information, see Change the content of an approved record.
Console
-
On the record detail page, choose Manage, and then choose Edit.
-
In the Skill content section, keep Upload a package selected.
The record keeps the package that you already uploaded unless you choose a new file. SKILL.md comes from the package, so upload a new package to change it.
-
Under Skill package, choose the new .zip file.
-
(Optional) For SHA-256 checksum, enter the checksum of the new file. On a record that already has a package, the checksum applies only to a file that you choose in this request. It doesn’t verify the stored package, so a checksum on its own, without a new file, has no effect.
-
Choose Save changes.
AWS CLI
On UpdateRegistryRecord, wrap the package in optionalValue:
SHA256=$(sha256sum my-skill.zip | cut -d ' ' -f 1) base64 -w 0 my-skill.zip > my-skill.zip.b64 jq -n \ --arg registryId "<registryId>" \ --arg recordId "<recordId>" \ --rawfile content my-skill.zip.b64 \ --arg sha256 "$SHA256" \ '{ registryId: $registryId, recordId: $recordId, recordVersion: "1.1", artifact: {optionalValue: {content: $content, sha256: $sha256}} }' > update-skill-record.json aws agent-registry-control update-registry-record \ --cli-input-json file://update-skill-record.json \ --region us-east-1
recordVersion is optional. Omit it to keep the record’s version.
AWS SDK
The following example uses the AWS SDK for Python (Boto3) to replace the package:
import hashlib import boto3 client = boto3.client('agent-registry-control') with open('my-skill.zip', 'rb') as f: package = f.read() response = client.update_registry_record( registryId='<registryId>', recordId='<recordId>', recordVersion='1.1', artifact={ 'optionalValue': { 'content': package, 'sha256': hashlib.sha256(package).hexdigest(), } }, ) print(f"Status: {response['status']}") # UPDATING
Remove the package
To remove an uploaded package, call UpdateRegistryRecord with artifact set to {}. The record no longer has a package, and GetRegistryRecord stops returning artifact. For an APPROVED record, the removal creates a new DRAFT revision, and discovery keeps returning the approved package until the new revision is approved. The record keeps the SKILL.md text that it had from the package (skillMd.data). To change that text too, send new skillMd.data in the same request.
artifact: {} removes only a package that you uploaded. It doesn’t change a record whose package comes from a synchronized source. To stop synchronizing a package, remove skillPackage from the record. For the request syntax, see Synchronize again or change the source.
Console
-
On the record detail page, choose Manage, and then choose Edit.
-
In the Skill content section, for Skill content source, choose Author inline.
-
For Content to include, choose Skill documentation only, Skill definition only, or Skill documentation and definition.
-
Enter the skill’s content.
-
Choose Save changes.
A skill that you author inline must have skill markdown or a skill definition. Enter one of them so that the console can save your changes.
AWS CLI
The following command removes the record’s uploaded package:
aws agent-registry-control update-registry-record \ --registry-id <registryId> \ --record-id <recordId> \ --artifact '{}' \ --region us-east-1
AWS SDK
The following example uses the AWS SDK for Python (Boto3) to remove the package:
import boto3 client = boto3.client('agent-registry-control') response = client.update_registry_record( registryId='<registryId>', recordId='<recordId>', artifact={}, # removes the uploaded package ) print(f"Status: {response['status']}") # UPDATING
Change how a record gets its content
A record gets its content in one way at a time: SKILL.md that you write, an uploaded package, or a source that the registry synchronizes from. To change the way, do one of the following:
-
From upload to synchronization — Call
UpdateRegistryRecordwith a newskillMd.sourceorskillPackage.source, and withoutartifact. The registry reads the source, and its content replaces the uploaded package. For more information, see Synchronize a skill from Amazon S3 and Synchronize a skill from GitHub. -
From synchronization to upload — Send the new package in
artifact.optionalValue. We recommend that you also remove the source in the same request. Otherwise, the source stays on the record. A latertriggerSynchronizationthen reads the source again and replaces your upload. -
From a package or a source to SKILL.md that you write — Call
UpdateRegistryRecordwith newskillMd.data, and withoutartifact,triggerSynchronization, or a new source. Your text replaces the package or the synchronized content, and the record no longer has a package. A source that the record had stays on the record, unused. If you later change that source or settriggerSynchronization, the registry reads the source again, and its content replaces your text.
Console
-
On the record detail page, choose Manage, and then choose Edit.
-
In the Skill content section, for Skill content source, choose Author inline, Upload a package, or Synchronize from source.
-
Complete the fields for the source that you chose, and then save the record.
The console warns you that saving with a different source replaces the record’s content with the new source’s, and removes the previous source, including an uploaded package. For the fields of each source, see the following:
-
Author inline – Remove the package
-
Upload a package – Replace the package in the console
-
Synchronize from source – Change an Amazon S3 source in the console, or Change a GitHub source in the console
The Synchronize from source tile appears only when you edit a record. To create a record that synchronizes, choose Synchronize from source in the Record source section of the Create record page instead. For more information, see Create a record that synchronizes from Amazon S3 and Create a record that synchronizes from GitHub.
On a record whose content comes from a package or a synchronized source, the markdown editor appears only on the Author inline tile. The package or the source owns SKILL.md. Choosing Author inline makes the markdown the record’s content, so you can edit it there. Saving then replaces the package or the source with what you entered.
The label above the editors differs by tile, because the package or the source already supplies SKILL.md. Author inline shows Content to include, where you choose the markdown, the definition, or both. Upload a package and Synchronize from source show Additional content, where the only choice is whether to add a skill definition.
AWS CLI
The following request body moves a record from synchronization to upload. It removes a full-package source and uploads a package in its place. Pass it with --cli-input-json, as described in AWS CLI:
{ "registryId": "<registryId>", "recordId": "<recordId>", "descriptors": { "optionalValue": { "agentSkillsDefinition": { "optionalValue": { "additionalData": { "optionalValue": { "skillPackage": {} } } } } } }, "artifact": { "optionalValue": { "content": "<base64 of the ZIP file>", "sha256": "<SHA-256 of the ZIP file>" } } }
AWS SDK
The following example uses the AWS SDK for Python (Boto3) to move a record from synchronization to upload:
import hashlib import boto3 client = boto3.client('agent-registry-control') with open('my-skill.zip', 'rb') as f: package = f.read() response = client.update_registry_record( registryId='<registryId>', recordId='<recordId>', descriptors={ 'optionalValue': { 'agentSkillsDefinition': { 'optionalValue': { 'additionalData': { 'optionalValue': { 'skillPackage': {} # removes the source } } } } } }, artifact={ 'optionalValue': { 'content': package, 'sha256': hashlib.sha256(package).hexdigest(), } }, ) print(f"Status: {response['status']}") # UPDATING
Request rules
The registry rejects an upload with a ValidationException in the following cases:
-
The record’s
recordTypeisn’tSKILL, or the record has noagentSkillsDefinitiondescriptor. -
The record was created by auto-detection.
-
The request also sets
triggerSynchronizationor a new skill source, or setsskillMd.source. -
The request also sends new
skillMd.data. The registry takes SKILL.md from the package. -
The content is empty, isn’t a ZIP archive, is larger than the maximum package size, or doesn’t match
sha256.