GetAgentCodePackageDownloadUrl - 获取智能体代码包下载地址
获取智能体已保存代码包下载地址
接口说明
为当前已保存的智能体配置引用的代码包生成限时只读下载地址,适用于本地上传和 OSS 导入的代码包。使用 workspaceId 和 agentId 定位,不接收任意 Bucket、Object Key 或历史版本参数。
当前配置必须引用可用的固定代码包,无需等待运行实例就绪。代码包不存在、已改变或不可读取时返回错误。链接最长有效 10 分钟,且不超过底层凭证期限;到期后重新调用。resourceVersionId 表示本次下载所对应的已保存配置版本。示例下载链接已脱敏,请使用本次响应中的 downloadUrl。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
agentcore:GetAgentCodePackageDownloadUrl |
get |
*CustomAgent
|
无 | 无 |
请求语法
GET /workspaces/{workspaceId}/custom-agents/{agentId}/code-package/download-url HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| workspaceId |
string |
是 |
工作空间 ID |
ws-a1b2c3d4e5f6 |
| agentId |
string |
是 |
自定义智能体 ID |
agent-550e8400e29b41d4a716446655440000 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
当前API无需请求参数
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| requestId |
string |
请求 ID |
550e8400-e29b-41d4-a716-446655440000 |
| message |
string |
响应消息 |
success |
| httpStatusCode |
integer |
HTTP 状态码 |
200 |
| code |
string |
业务状态码 |
SUCCESS |
| success |
boolean |
请求是否成功 |
|
| data |
object |
返回结果 |
|
| downloadUrl |
string |
限时只读代码包下载地址 |
https://agentcore-platform-example.oss-cn-hangzhou.aliyuncs.com/code-packages/workspaces/ws-a1b2c3d4e5f6/550e8400-e29b-41d4-a716-446655440000/package.zip?OSSAccessKeyId=LTAI5tExample****&Expires=1792627800&Signature=ExampleSignature**** |
| expiresAt |
string |
下载地址过期时间 |
2026-10-22T00:10:00Z |
| fileName |
string |
原始代码包文件名 |
main.zip |
| fileSize |
integer |
代码包压缩大小 |
123 |
| format |
string |
代码包格式 枚举值:
|
zip |
| etag |
string |
代码包对象 ETag |
fixed-etag |
| crc64 |
string |
代码包对象 CRC64 |
456 |
| resourceVersionId |
string |
当前已保存配置对应的资源版本 ID |
42 |
示例
正常返回示例
JSON格式
{
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"message": "success",
"httpStatusCode": 200,
"code": "SUCCESS",
"success": true,
"data": {
"downloadUrl": "https://agentcore-platform-example.oss-cn-hangzhou.aliyuncs.com/code-packages/workspaces/ws-a1b2c3d4e5f6/550e8400-e29b-41d4-a716-446655440000/package.zip?OSSAccessKeyId=LTAI5tExample****&Expires=1792627800&Signature=ExampleSignature****",
"expiresAt": "2026-10-22T00:10:00Z",
"fileName": "main.zip",
"fileSize": 123,
"format": "zip",
"etag": "fixed-etag",
"crc64": "456",
"resourceVersionId": "42"
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | A code package request parameter is invalid. | |
| 403 | Forbidden | The caller is not allowed to access the specified workspace or agent. | |
| 404 | Resource.NotFound | The specified workspace does not exist. | |
| 404 | AgentCodePackage.ObjectNotFound | The fixed platform code package object does not exist. | |
| 503 | AgentCodePackage.StorageUnavailable | The platform code package storage is unavailable. | |
| 409 | Workspace.Operation.Conflict | The workspace cannot accept this operation in its current state. | |
| 409 | AgentCodePackage.Unavailable | The saved configuration has no downloadable code package. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。