Load the agent package

Verify and load the .moiagent agent package to the target workspace.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-packages/load

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare the personal access token that can access the target workspace, the target workspace ID, and the .moiagent package file to be loaded.

  • Create new agent: Agent creation permission is required.

  • Update existing agent: Agent update permission is required.

  • Read resources within the package: Requires read permissions for the associated volume and knowledge base.

Confirm that the resource references in the package are valid. Workspace access does not replace read permission on associated resources.

Request body

The upper limit of the uploaded agent package text is 128 MiB. Packages that exceed the upper limit or cannot be parsed will be rejected. The client should retain the original package and failure information, and cannot treat the failure response as no loading record was generated.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-packages/load" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/octet-stream' \
  --data-binary "@$PACKAGE_FILE"

Path parameters

Field

Type

Required

Description

workspace_id

string

Yes

Load the ID of the target workspace.

Request body

The request body is the complete binary content of the .moiagent package file. Submit using application/octet-stream and do not use JSON objects or package_file fields to encapsulate the file content.

Successful response

JSON
{
  "code": 0,
  "data": {
    "plan": {
      "workspace_id": "ws_01",
      "agent_id": "agent_01",
      "agent_version": "1.0.0",
      "source_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "resource_files": {},
      "status": "validated"
    },
    "version": {
      "workspace_id": "ws_01",
      "agent_id": "agent_01",
      "version": "1.0.0",
      "source_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "min_moi_version": "5.0.0",
      "manifest": {
        "schemaVersion": 1,
        "id": "agent_01",
        "version": "1.0.0",
        "name": "摘要助手",
        "model": "model-example",
        "instruction": {
          "path": "instructions/main.md"
        },
        "moiResourceRefs": {
          "tools": [],
          "skills": [],
          "knowledgeBases": [],
          "channelBindings": []
        }
      },
      "status": "runnable",
      "loaded_by": "user_01",
      "loaded_at": "2026-10-14T00:00:00Z"
    }
  }
}

Field

Type

Description

code

integer

0 when the request is processed successfully.

data

object

response data.

data.plan

object

Agent package loading plan.

data.plan.workspace_id

string

Target workspace ID.

data.plan.agent_id

string

agent ID.

data.plan.agent_version

string

The agent version declared in the package.

data.plan.source_digest

string

Summary of package contents.

data.plan.resource_files

object

List of resource files in the package.

data.plan.resource_files.instruction

string

agent command. Can be omitted if not set.

data.plan.resource_files.custom_tool_dirs

array of string

Custom tool directory. Can be omitted if not set.

data.plan.resource_files.custom_skill_dirs

array of string

Custom skill catalog. Can be omitted if not set.

data.plan.status

string

Load plan status.

data.plan.diagnostics

array of object

diagnostic information. Does not return when no diagnosis is generated. Can be omitted if not set.

data.plan.diagnostics[].severity

string

Prompt level. Value: pending, error.

data.plan.diagnostics[].code

string

error code.

data.plan.diagnostics[].message

string

Operating Instructions.

data.plan.diagnostics[].ref

string

Resource references. Can be omitted if not set.

data.version

object

The loaded agent version.

data.version.workspace_id

string

The workspace ID to which it belongs.

data.version.agent_id

string

The agent ID to which the loaded version belongs.

data.version.version

string

The version identifier that has been loaded.

data.version.foundation_ref

string

Base agent version reference. Can be omitted if not set.

data.version.source_digest

string

A summary of the package contents of the version.

data.version.min_moi_version

string

Minimum CloudSigma version required by the package.

data.version.manifest

object

Package list.

data.version.manifest.schemaVersion

integer

Package manifest structure version.

data.version.manifest.id

string

Object ID.

data.version.manifest.version

string

Current version number.

data.version.manifest.name

string

Name.

data.version.manifest.description

string

Description. Can be omitted if not set.

data.version.manifest.model

string

Association model.

data.version.manifest.model_config_ref

string

Model configuration reference. Can be omitted if not set.

data.version.manifest.minMOIVersion

string

Minimum CloudSigma version required by the package. Can be omitted if not set.

data.version.manifest.instruction

object

agent command.

data.version.manifest.instruction.path

string

Relative path within the package.

data.version.manifest.moiResourceRefs

object

The associated CloudSigma resource reference.

data.version.manifest.moiResourceRefs.tools

array of object

List of discovered tools.

data.version.manifest.moiResourceRefs.tools[].name

string

Name.

data.version.manifest.moiResourceRefs.tools[].workspace_id

string

The workspace ID to which it belongs. Can be omitted if not set.

data.version.manifest.moiResourceRefs.skills

array of object

Skills list.

data.version.manifest.moiResourceRefs.skills[].name

string

Name.

data.version.manifest.moiResourceRefs.skills[].workspace_id

string

The workspace ID to which it belongs. Can be omitted if not set.

data.version.manifest.moiResourceRefs.knowledgeBases

array of object

Associated knowledge base list.

data.version.manifest.moiResourceRefs.knowledgeBases[].name

string

Name.

data.version.manifest.moiResourceRefs.knowledgeBases[].workspace_id

string

The workspace ID to which it belongs. Can be omitted if not set.

data.version.manifest.moiResourceRefs.catalogFiles

array of object

Catalog files associated with the package. Can be omitted if not set.

data.version.manifest.moiResourceRefs.catalogFiles[].workspaceID

string

The workspace ID where the resource is located.

data.version.manifest.moiResourceRefs.catalogFiles[].volumeID

integer

Volume ID.

data.version.manifest.moiResourceRefs.catalogFiles[].fileID

string

Associated file ID.

data.version.manifest.moiResourceRefs.channelBindings

array of object

Channel binding list.

data.version.manifest.moiResourceRefs.channelBindings[].toolName

string

Tool name. Can be omitted if not set.

data.version.manifest.moiResourceRefs.channelBindings[].toolWorkspaceID

string

The workspace ID where the tool is located. Can be omitted if not set.

data.version.manifest.moiResourceRefs.channelBindings[].skillName

string

Skill name. Can be omitted if not set.

data.version.manifest.moiResourceRefs.channelBindings[].skillWorkspaceID

string

The workspace ID where the skill is located. Can be omitted if not set.

data.version.manifest.moiResourceRefs.channelBindings[].provider

string

Provider ID. Can be omitted if not set.

data.version.manifest.moiResourceRefs.channelBindings[].workspaceID

string

The workspace ID where the resource is located.

data.version.manifest.moiResourceRefs.channelBindings[].instanceID

string

Channel instance ID.

data.version.status

string

Version status loaded.

data.version.diagnostics

array of object

Version diagnostic information. Does not return when no diagnosis is generated. Can be omitted if not set.

data.version.diagnostics[].severity

string

Prompt level. Value: pending, error.

data.version.diagnostics[].code

string

error code.

data.version.diagnostics[].message

string

Operating Instructions.

data.version.diagnostics[].ref

string

Resource references. Can be omitted if not set.

data.version.loaded_by

string

The user ID that loaded this version.

data.version.loaded_at

string

Loading time.

data.version.disabled_by

string

Deactivator ID. Can be omitted if not set.

data.version.disabled_at

string

Deactivation time. Can be omitted if not set.

Error response

JSON
{
  "code": 2,
  "message": "invalid agent package"
}

Field

Type

Description

code

integer

error code.

message

string

Error description.

After the version is successfully loaded and saved, an error may still be returned during the operation record writing phase. If you encounter such an error, first check whether the target agent and version already exist. Do not directly load it repeatedly.

Last updated on