@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
44 lines • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Versions = void 0;
const resource_1 = require("../../../core/resource.js");
const pagination_1 = require("../../../core/pagination.js");
const headers_1 = require("../../../internal/headers.js");
const tracing_1 = require("../../../internal/tracing.js");
const path_1 = require("../../../internal/utils/path.js");
class Versions extends resource_1.APIResource {
/**
* List Agent Versions
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const betaManagedAgentsAgent of client.beta.agents.versions.list(
* 'agent_011CZkYpogX7uDKUyvBTophP',
* )) {
* // ...
* }
* ```
*/
list(agentID, params = {}, options) {
const { betas, workspace_id, ...query } = params ?? {};
return this._client.getAPIList((0, path_1.path) `/v1/agents/${agentID}/versions?beta=true`, (pagination_1.PageCursor), {
query,
...options,
headers: (0, headers_1.buildHeaders)([
{
'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString(),
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
},
options?.headers,
]),
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.agents.versions.list', options, {
route: '/v1/agents/{agent_id}/versions',
queryParams: ['limit', 'page'],
attributes: { 'gen_ai.agent.id': agentID },
}),
});
}
}
exports.Versions = Versions;
//# sourceMappingURL=versions.js.map