@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
40 lines • 1.57 kB
JavaScript
import { APIResource } from "../../../core/resource.mjs";
import { PageCursor } from "../../../core/pagination.mjs";
import { buildHeaders } from "../../../internal/headers.mjs";
import { startApiCallSpan } from "../../../internal/tracing.mjs";
import { path } from "../../../internal/utils/path.mjs";
export class Versions extends 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(path `/v1/agents/${agentID}/versions?beta=true`, (PageCursor), {
query,
...options,
headers: buildHeaders([
{
'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString(),
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
},
options?.headers,
]),
__span: startApiCallSpan(this._client, 'anthropic.agents.versions.list', options, {
route: '/v1/agents/{agent_id}/versions',
queryParams: ['limit', 'page'],
attributes: { 'gen_ai.agent.id': agentID },
}),
});
}
}
//# sourceMappingURL=versions.mjs.map