Skip to content
中文

Publish a skill and read it back

Use the API to create a repository, publish a skill that contains only SKILL.md as 1.0.0, read back its metadata and file, publish 1.0.1, and finally withdraw 1.0.0. Every step lists the expected result.

Prerequisites: an organization API key (see API keys) in the PRAXIS_API_KEY environment variable, plus curl and jq. Set PRAXIS_API_BASE to target another environment; the default is https://api.deepraxis.com. Every name carries a docs-example prefix and a timestamp so reruns do not collide: repository and package names are unique within an organization.

1. Create a repository

A repository name uses lowercase letters, digits and hyphens, up to 63 characters.

终端窗口
export BASE="${PRAXIS_API_BASE:-https://api.deepraxis.com}"
export TAG=$(date +%s)
REPO_JSON=$(curl --fail-with-body -sS -X POST "$BASE/registry/v1/repositories" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg name "docs-example-lib-$TAG" '{name: $name, display_name: "Docs example"}')")
export REPO_ID=$(printf '%s' "$REPO_JSON" | jq -er '.id')
printf '%s\n' "$REPO_JSON"

Expected: HTTP 201, format is oci, is_default is false, package_count is 0.

2. Publish 1.0.0

One call creates the package and uploads its first version; the body is multipart/form-data. version is required; send the content as either archive (one zip) or files (a set of files), not both, and give each file’s filename as its path relative to the package root. The package name comes from the name: line at the top of SKILL.md, not from the upload path.

终端窗口
mkdir -p skill-src
cat > skill-src/SKILL.md <<SKILL
---
name: docs-example-greeter-$TAG
description: Greets the user in one short sentence.
---
Greet the user in one short sentence.
SKILL
PKG_JSON=$(curl --fail-with-body -sS -X POST "$BASE/registry/v1/repositories/$REPO_ID/packages" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-F "version=1.0.0" \
-F "tags=docs,example" \
-F "files=@skill-src/SKILL.md;filename=SKILL.md")
export PKG_ID=$(printf '%s' "$PKG_JSON" | jq -er '.id')
printf '%s\n' "$PKG_JSON" | jq '{id, name, kind, description, tags, latest_version, downloads}'

Expected: HTTP 201, kind is skill, description comes from SKILL.md, tags is ["docs","example"], latest_version is 1.0.0, downloads is 0.

3. Read it back

终端窗口
curl --fail-with-body -sS "$BASE/registry/v1/packages/$PKG_ID/versions/1.0.0/contents" \
-H "Authorization: Bearer $PRAXIS_API_KEY" | jq '.data'
curl --fail-with-body -sS "$BASE/registry/v1/packages/$PKG_ID/versions/1.0.0/files/SKILL.md" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Expected: the listing has one entry whose path is SKILL.md; the second request returns the file you uploaded, byte for byte. Neither read counts toward downloads; each whole-package download (.../versions/1.0.0/archive) counts once, so do not pull the archive repeatedly just to look inside.

4. Publish 1.0.1

Publishing a new version of an existing package takes the same body as step 2, but kind and name are inherited from the package. The version must be higher than the highest published version.

终端窗口
echo "Keep it friendly." >> skill-src/SKILL.md
curl --fail-with-body -sS -X POST "$BASE/registry/v1/packages/$PKG_ID/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-F "version=1.0.1" \
-F "files=@skill-src/SKILL.md;filename=SKILL.md" | jq '{version, digest, size_bytes, withdrawn}'
curl --fail-with-body -sS "$BASE/registry/v1/packages/$PKG_ID/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" | jq '[.data[] | {version, withdrawn}]'

Expected: HTTP 201 with withdrawn false; the version list shows 1.0.1 first and 1.0.0 after it, and the package’s latest_version becomes 1.0.1.

Failure branch: publish 1.0.1 a second time and you get HTTP 409 with error.code FAILED_PRECONDITION; the message says the new version must be greater than the existing one.

5. Withdraw 1.0.0

终端窗口
curl --fail-with-body -sS -X POST "$BASE/registry/v1/packages/$PKG_ID/versions/1.0.0:withdraw" \
-H "Authorization: Bearer $PRAXIS_API_KEY" | jq '{version, withdrawn, withdraw_time}'

Expected: HTTP 200, withdrawn is true with a withdraw_time. Withdrawing is irreversible: the version can no longer be newly installed and its number can never be reused. To offer it again, publish under a higher number.

Read with the SDK

Methods of the official @deepraxis/sdk live under praxis.registry.*. Publishing is a multipart upload, so this SDK example only reads the package published in step 2.

import { Praxis } from '@deepraxis/sdk';
const praxis = new Praxis({
apiKey: process.env.PRAXIS_API_KEY!,
baseUrl: process.env.PRAXIS_API_BASE ?? 'https://api.deepraxis.com',
});
const packageId = process.env.PKG_ID!;
const pkg = await praxis.registry.packages.retrieve({ path: { package_id: packageId } });
console.log(pkg.kind, pkg.latest_version);
const versions = await praxis.registry.packages.versions.list({ path: { package_id: packageId } });
console.log(versions.data.map(v => `${v.version}${v.withdrawn ? ' (withdrawn)' : ''}`));

Clean up

There is no endpoint to delete a package yet: the package and the repository that holds it stay, and deleting a non-empty repository returns 409 FAILED_PRECONDITION. Withdraw every version of the example package; it can then no longer be installed on any target.

终端窗口
curl --fail-with-body -sS -X POST "$BASE/registry/v1/packages/$PKG_ID/versions/1.0.1:withdraw" \
-H "Authorization: Bearer $PRAXIS_API_KEY" | jq '{version, withdrawn}'

Install on an agent → · Limits and errors →