Generate agent candidate solutions

Submit a complete agent candidate configuration, and the service will verify and save the candidate version.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-builder/candidates

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. First Query the available resources for agent construction to obtain the resource list. Prepare a personal access token and target workspace ID that can access the target workspace.

Request body

Replace $WORKSPACE_ID, $CLOUDSIGMA_API_KEY in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-builder/candidates" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "mode": "create",
  "conversation_id": "<CONVERSATION_ID>",
  "raw_advice": "创建一个回答产品问题的智能体。",
  "resources": {
    "models": [],
    "tools": [],
    "skills": [],
    "knowledge_bases": []
  },
  "candidate": {
    "agent_id": "<AGENT_ID>",
    "name": "产品助手",
    "description": "回答产品问题。",
    "model_name": "<MODEL_NAME>",
    "tool_names": [],
    "skill_names": [],
    "knowledge_base_names": [],
    "channel_bindings": [],
    "agent_md": "# 产品助手",
    "change_reason": "初始创建"
  }
}'

Parameter

Type

Required

Description

workspace_id

string

Yes

workspace ID.

Request body

Field

Type

Required

Description

mode

string

Yes

Build mode. To create a new agent use create. Value: create, revise.

conversation_id

string

Yes

The session ID to which this build belongs. Cannot be empty.

task_id

string

No

The associated task ID.

source_agent_id

string

No

Source agent ID.

source_agent_workspace_id

string

No

Source agentworkspace. Cannot be empty.

source_version

string

No

Source version.

raw_advice

string

Yes

The original request for this creation or modification.

advice_user_id

string

No

Proposed user ID.

resources

object

Yes

Select the resource collection returned in the build resource.

resources.models

array of object

When the object is provided

Model collection.

resources.models[].name

string

When the object is provided

Name. Cannot be empty.

resources.models[].model_name

string

No

Model name.

resources.models[].display_name

string

No

Display name.

resources.models[].model_config_ref

string

No

Model configuration reference.

resources.tools

array of object

When the object is provided

Tool collection.

resources.tools[].name

string

When the object is provided

Name. Cannot be empty.

resources.tools[].id

string

When the object is provided

logo. Cannot be empty.

resources.tools[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

resources.skills

array of object

When the object is provided

Skill set.

resources.skills[].name

string

When the object is provided

Name. Cannot be empty.

resources.skills[].id

string

When the object is provided

logo. Cannot be empty.

resources.skills[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

resources.knowledge_bases

array of object

When the object is provided

knowledge base reference.

resources.knowledge_bases[].name

string

When the object is provided

Name. Cannot be empty.

resources.knowledge_bases[].id

string

When the object is provided

logo. Cannot be empty.

resources.knowledge_bases[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

candidate

object

No

Complete candidate agent configuration.

candidate.agent_id

string

When the object is provided

The new candidate agent ID. Cannot be empty.

candidate.name

string

When the object is provided

agent name.

candidate.description

string

When the object is provided

agent description.

candidate.model_name

string

When the object is provided

Model names available in resources.models.

candidate.model_config_ref

string

No

Model configuration reference.

candidate.tool_names

array of string

When the object is provided

The name of the selected tool. Pass an empty array when there are no tools.

candidate.skill_names

array of string

When the object is provided

The name of the selected skill. Pass empty array when there is no skill.

candidate.knowledge_base_names

array of string

When the object is provided

The selected knowledge base name. If there is no knowledge base, an empty array is passed.

candidate.catalog_files

array of object

No

Catalog file reference.

candidate.catalog_files[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

candidate.catalog_files[].volume_id

integer

When the object is provided

Volume ID. Not less than 1.

candidate.catalog_files[].file_id

string

When the object is provided

File ID. Cannot be empty.

candidate.channel_bindings

array of object

No

Candidate channel binding, can be omitted.

candidate.channel_bindings[].tool_name

string

No

Tool name.

candidate.channel_bindings[].tool_workspace_id

string

No

Tool source workspace ID.

candidate.channel_bindings[].skill_name

string

No

Skill name.

candidate.channel_bindings[].skill_workspace_id

string

No

Skill source workspace ID.

candidate.channel_bindings[].provider

string

No

Provider.

candidate.channel_bindings[].workspace_id

string

When the object is provided

The workspace ID to which it belongs.

candidate.channel_bindings[].instance_id

string

When the object is provided

Channel instance ID.

candidate.agent_md

string

When the object is provided

Editable agent Markdown text.

candidate.change_reason

string

When the object is provided

Reason for this candidate change.

resource_refs

object

No

Full source citation.

resource_refs.tools

array of object

When the object is provided

Tool collection.

resource_refs.tools[].id

string

When the object is provided

logo. Cannot be empty.

resource_refs.tools[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

resource_refs.skills

array of object

When the object is provided

Skill set.

resource_refs.skills[].id

string

When the object is provided

logo. Cannot be empty.

resource_refs.skills[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

resource_refs.knowledge_bases

array of object

When the object is provided

knowledge base reference.

resource_refs.knowledge_bases[].id

string

When the object is provided

logo. Cannot be empty.

resource_refs.knowledge_bases[].workspace_id

string

When the object is provided

The workspace ID to which it belongs. Cannot be empty.

changes

object

No

Change collection.

Entries for candidate.catalog_files include workspace_id, volume_id, and file_id. channel_bindings can be omitted when the candidate has no channel binding.

candidate and changes cannot be submitted at the same time. Fill in base_revision when revising, and retain complete resource citation information. When using changes, fill in the structure according to the structure of adding, deleting resources and modifying configuration.

The list of currently available knowledge bases is inconsistent with the paging range of the candidate resolution. Knowledge bases outside the parsing window may not be referenced. Changing IDs does not guarantee bypassing this restriction.

Successful response

JSON
{
  "code": 0,
  "data": {
    "render_type": "agent_candidate",
    "workspace_id": "ws_01",
    "agent_id": "agent_01",
    "candidate_version": "0.2.0",
    "load_version": "0.2.0",
    "source_digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
    "mode": "create",
    "status": "valid",
    "display": {
      "agent_name": "产品助手",
      "agent_id": "agent_01",
      "candidate_version": "0.2.0",
      "load_version": "0.2.0",
      "model": "",
      "tools": null,
      "skills": null,
      "knowledge_bases": null,
      "catalog_files": [],
      "channel_bindings": [],
      "agent_md": "",
      "change_reason": ""
    },
    "resolved_refs": {},
    "package_summary": {
      "manifest_path": "",
      "prompt_path": "",
      "file_paths": []
    }
  }
}

Field

Type

Description

data.render_type

string

Display type. Fixed to “agent_candidate”.

data.workspace_id

string

The workspace and agent identification to which the candidate belongs.

data.agent_id

string

The workspace and agent identification to which the candidate belongs.

data.candidate_version

string

Candidate version for subsequent regeneration, validation, or cancellation.

data.load_version

string

After successful confirmation, it is used to view the version of the loaded agent configuration.

data.source_digest

string

Summary of current candidate content. Subsequent write operations must return this value.

data.mode

string

Build modes and candidate states. Value: create, revise.

data.status

string

Build modes and candidate states. Value: valid, invalid.

data.display

object

Display-oriented content candidates, validation diagnostics, and resolved resource references.

data.display.agent_name

string

agent name.

data.display.agent_id

string

agent ID.

data.display.candidate_version

string

Release Candidate.

data.display.load_version

string

Load version.

data.display.model

string

model.

data.display.tools

array of string or null

Tool collection.

data.display.skills

array of string or null

Skill set.

data.display.knowledge_bases

array of string or null

knowledge base reference.

data.display.catalog_files

array of object

Catalog file reference.

data.display.catalog_files[].workspace_id

string

The workspace ID to which it belongs.

data.display.catalog_files[].volume_id

integer

Volume ID.

data.display.catalog_files[].file_id

string

File ID.

data.display.channel_bindings

array of object

Channel binding.

data.display.channel_bindings[].tool_name

string

Tool name.

data.display.channel_bindings[].tool_workspace_id

string

Tool source workspace ID.

data.display.channel_bindings[].skill_name

string

Skill name.

data.display.channel_bindings[].skill_workspace_id

string

Skill source workspace ID.

data.display.channel_bindings[].provider

string

Provider.

data.display.channel_bindings[].workspace_id

string

The workspace ID to which it belongs.

data.display.channel_bindings[].instance_id

string

Channel instance ID.

data.display.agent_md

string

agentMarkdown text.

data.display.change_reason

string

Reason for change.

data.diagnostics

array of object

Display-oriented content candidates, validation diagnostics, and resolved resource references. At least 1 items.

data.diagnostics[].severity

string

Diagnostic level.

data.diagnostics[].code

string

Error or diagnostic code.

data.diagnostics[].message

string

Message content.

data.diagnostics[].field_path

string

Field path.

data.diagnostics[].resource_ref

string

Resource references.

data.resolved_refs

object

Display-oriented content candidates, validation diagnostics, and resolved resource references.

data.resolved_refs.model

object

model.

data.resolved_refs.model.name

string

Name.

data.resolved_refs.model.id

string

logo.

data.resolved_refs.model.workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.model.requested_name

string

The name when requested.

data.resolved_refs.tools

array of object

Tool collection.

data.resolved_refs.tools[].name

string

Name.

data.resolved_refs.tools[].id

string

logo.

data.resolved_refs.tools[].workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.tools[].requested_name

string

The name when requested.

data.resolved_refs.skills

array of object

Skill set.

data.resolved_refs.skills[].name

string

Name.

data.resolved_refs.skills[].id

string

logo.

data.resolved_refs.skills[].workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.skills[].requested_name

string

The name when requested.

data.resolved_refs.skill_tools

array of object

Skill tool mapping.

data.resolved_refs.skill_tools[].skill_name

string

Skill name.

data.resolved_refs.skill_tools[].skill_id

string

Skill ID.

data.resolved_refs.skill_tools[].skill_workspace_id

string

Skill source workspace ID.

data.resolved_refs.skill_tools[].tool_name

string

Tool name.

data.resolved_refs.skill_tools[].tool_id

string

Tool ID.

data.resolved_refs.skill_tools[].tool_workspace_id

string

Tool source workspace ID.

data.resolved_refs.knowledge_bases

array of object

knowledge base reference.

data.resolved_refs.knowledge_bases[].name

string

Name.

data.resolved_refs.knowledge_bases[].id

string

logo.

data.resolved_refs.knowledge_bases[].workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.knowledge_bases[].requested_name

string

The name when requested.

data.resolved_refs.catalog_files

array of object

Catalog file reference.

data.resolved_refs.catalog_files[].workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.catalog_files[].volume_id

integer

Volume ID.

data.resolved_refs.catalog_files[].file_id

string

File ID.

data.resolved_refs.channel_bindings

array of object

Channel binding.

data.resolved_refs.channel_bindings[].tool_name

string

Tool name.

data.resolved_refs.channel_bindings[].tool_workspace_id

string

Tool source workspace ID.

data.resolved_refs.channel_bindings[].skill_name

string

Skill name.

data.resolved_refs.channel_bindings[].skill_workspace_id

string

Skill source workspace ID.

data.resolved_refs.channel_bindings[].provider

string

Provider.

data.resolved_refs.channel_bindings[].workspace_id

string

The workspace ID to which it belongs.

data.resolved_refs.channel_bindings[].instance_id

string

Channel instance ID.

data.package_summary

object

Summary of candidate package files. Return when available.

data.package_summary.manifest_path

string

Manifest file path.

data.package_summary.prompt_path

string

Prompt word file path.

data.package_summary.file_paths

array of string

List of file paths.

Error response

JSON
{
  "code": 2,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

The request contains unknown fields, required fields are missing, and the candidate configuration or resource reference is invalid. Recommendation: Fix request based on error message and diagnostics.

401

6(UNAUTHENTICATED)

Valid identity credentials are missing. Recommendation: Check the API Key.

403

5(PERMISSION_DENIED)

The current identity does not have permission to create or modify candidates. Recommendation: Check the workspace and source agent authorization.

409

4(ALREADY_EXISTS)

There are parallel authoring contexts or candidate conflicts for the same agent. Suggestion: Read the current candidate and resubmit.

413

14(RESOURCE_EXHAUSTED)

resources exceeds the allowed size of the interface. Suggestion: Reduce the resource list and try again.

500

1(INTERNAL)

Candidate build failed. Suggestion: Try again later. Contact support if it continues to fail.

503

15(UNAVAILABLE)

Agent building or authorization services are temporarily unavailable. Suggestion: Check the current status first. Do not automatically resubmit.

Last updated on