Confirm agent candidate solutions¶
Confirm a verified candidate solution and load it as a readable agent version.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agent-builder/candidates/{agent_id}/candidate-versions/{candidate_version}/commit
Preparation before calling¶
First generate the agent candidate program or regenerate the agent candidate program] to obtain the candidate version and source_digest. Prepare a personal access token with access to the target workspace, target workspace ID, agent ID, and release candidate.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and also asworkspace_idin the path.$AGENT_ID: Agent ID, asagent_idin the path.$CANDIDATE_VERSION: The release candidate to be confirmed ascandidate_versionin the path.$SOURCE_DIGEST: Digest from the current candidate response forsource_digestin the request body.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agent-builder/candidates/$AGENT_ID/candidate-versions/$CANDIDATE_VERSION/commit" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"source_digest": "'"$SOURCE_DIGEST"'"
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Workspace ID. |
|
string |
Yes |
Agent ID. |
|
string |
Yes |
Candidate version to confirm. |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The digest in the current candidate response. |
|
object |
No |
Metadata to write. |
|
object |
No |
Runtime environment binding override. |
Successful response¶
Returns 200 on success. Save load_version and use it to query the current agent configuration.
{
"code": 0,
"data": {
"workspace_id": "ws_01",
"agent_id": "agent_01",
"name": "产品助手",
"load_version": "v1",
"source_digest": "sha256:<HEX_DIGEST>",
"package_digest": "sha256:<HEX_DIGEST>"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Workspace, ID and name of the loaded agent. |
|
string |
Workspace, ID and name of the loaded agent. |
|
string |
Workspace, ID and name of the loaded agent. |
|
string |
Loaded version; used to query the current agent configuration. |
|
string |
Confirmed candidate content summary and loaded package summary. |
|
string |
Confirmed candidate content summary and loaded package summary. |
Error response¶
{
"code": 4,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request contains unknown fields, candidate content, or the binding override is invalid. |
Check the request body and candidate diagnostics. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have the authority to confirm the candidate. |
Check workspace and agent authorizations. |
|
|
Release candidate does not exist. |
Check for release candidates. |
|
|
The candidate summary does not match, the candidate has been replaced, or the current status cannot be confirmed. |
Get the latest candidate and use it |
|
|
Candidate loading failed. |
Regenerate after correcting the configuration according to the candidate diagnosis. |
|
|
Agent construction or authorization services are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Use load_version Query the current agent configuration.