import { AgentAPIAttributes, AgentMetadata, NvmAPIResult, PaginationOptions, PaymentOptions, PlanCreditsConfig, PlanMetadata, PlanPriceConfig } from '../common/types.js'; import { BasePaymentsAPI, PublicationOptions } from './base-payments.js'; export type { PublicationOptions } from './base-payments.js'; /** * The AgentsAPI class provides methods to register and interact with AI Agents on Nevermined. */ export declare class AgentsAPI extends BasePaymentsAPI { /** * This method is used to create a singleton instance of the AgentsAPI class. * * @param options - The options to initialize the payments class. * @returns The instance of the AgentsAPI class. */ static getInstance(options: PaymentOptions): AgentsAPI; /** * * It registers a new AI Agent on Nevermined. * The agent must be associated to one or multiple Payment Plans. Users that are subscribers of a payment plan can query the agent. * Depending on the Payment Plan and the configuration of the agent, the usage of the agent/service will consume credits. * When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent. * * @remarks This method is oriented to AI Builders * @remarks To call this method, the NVM API Key must have publication permissions * * @see https://nevermined.ai/docs/tutorials/builders/register-agent * * @param agentMetadata - @see {@link AgentMetadata} * @param agentApi - @see {@link AgentAPIAttributes} * @param paymentPlans - the list of payment plans giving access to the agent. * * @example * ``` * const agentMetadata = { name: 'My AI Payments Agent', tags: ['test'] } * const agentApi = { endpoints: [{ 'POST': 'https://example.com/api/v1/agents/:agentId/tasks' }] } * const paymentPlans = [planId] * * const { agentId } = await payments.agents.registerAgent(agentMetadata, agentApi, paymentPlans) * ``` * * @returns The unique identifier of the newly created agent (Agent Id). */ registerAgent(agentMetadata: AgentMetadata, agentApi: AgentAPIAttributes, paymentPlans: string[], publicationOptions?: PublicationOptions): Promise<{ agentId: string; }>; /** * * It registers a new AI Agent and a Payment Plan associated to this new agent. * Depending on the Payment Plan and the configuration of the agent, the usage of the agent/service will consume credits. * When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent. * * @remarks This method is oriented to AI Builders * @remarks To call this method, the NVM API Key must have publication permissions * * @see https://nevermined.ai/docs/tutorials/builders/register-agent * * @param agentMetadata - @see {@link AgentMetadata} * @param agentApi - @see {@link AgentAPIAttributes} * @param planMetadata - @see {@link PlanMetadata} * @param priceConfig - @see {@link PlanPriceConfig} * @param creditsConfig - @see {@link PlanCreditsConfig} * * @example * ``` * const agentMetadata = { name: 'My AI Payments Agent', tags: ['test'] } * const agentApi { endpoints: [{ 'POST': 'https://example.com/api/v1/agents/:agentId/tasks' }] } * const cryptoPriceConfig = getNativeTokenPriceConfig(100n, builderAddress) * const 1dayDurationPlan = getExpirableDurationConfig(ONE_DAY_DURATION) * const { agentId, planId } = await payments.agents.registerAgentAndPlan( * agentMetadata, * agentApi, * cryptoPriceConfig, * 1dayDurationPlan * ) * ``` * * @returns The unique identifier of the newly created agent (agentId). * @returns The unique identifier of the newly created plan (planId). */ registerAgentAndPlan(agentMetadata: AgentMetadata, agentApi: AgentAPIAttributes, planMetadata: PlanMetadata, priceConfig: PlanPriceConfig, creditsConfig: PlanCreditsConfig, accessLimit?: 'credits' | 'time', publicationOptions?: PublicationOptions): Promise<{ agentId: string; planId: string; txHash: string; }>; /** * Gets the metadata for a given Agent identifier. * * @param agentId - The unique identifier of the agent. * @returns A promise that resolves to the agent's metadata. * @throws PaymentsError if the agent is not found. * * @example * ``` * const plan = payments.agents.getAgent(agentId) * ``` */ getAgent(agentId: string): Promise; /** * Updates the metadata and API attributes of an existing AI Agent. * * @param agentId - The unique identifier of the agent. * @param agentMetadata - The new metadata attributes for the agent. * @param agentApi - The new API attributes for the agent. * @returns @see {@link NvmAPIResult} A promise that resolves indicating if the operation was successful. * @throws PaymentsError if the agent is not found or if the update fails. * * @example * ``` * const agentMetadata = { name: 'My Updated Agent', tags: ['test'] } * const agentApi = { endpoints: [{ 'POST': 'https://nevermined.app/api/v1/agents/:agentId/tasks' }] } * * await payments.agents.updateAgentMetadata(agentId, agentMetadata, agentApi) * ``` */ updateAgentMetadata(agentId: string, agentMetadata: AgentMetadata, agentApi: AgentAPIAttributes): Promise; /** * Gets the list of plans that can be ordered to get access to an agent. * * @param agentId - The unique identifier of the agent. * @param pagination - Optional pagination options to control the number of results returned.p * @returns A promise that resolves to the list of all different plans giving access to the agent. * @throws PaymentsError if the agent is not found. * * @example * ``` * const result = payments.agents.getAgentPlans(planId) * // { * // total: 10, * // page: 1, * // offset: 5, * // plans: [ ..] * // } * ``` */ getAgentPlans(agentId: string, pagination?: PaginationOptions): Promise; /** * Lists the AI agents **you** published (the authenticated caller's own * agents). This is account management, not a marketplace search — it never * returns other users' agents. * * @param page - The page number to retrieve. * @param offset - The number of items per page. * @param sortBy - The field to sort the results by. * @param sortOrder - The order in which to sort the results. * @param orgId - Optional organization id. When set, returns every agent in * that organization (requires active membership) instead of the caller's. * @returns A promise that resolves to the paginated list of your agents. */ getAgents(page?: number, offset?: number, sortBy?: string, sortOrder?: 'asc' | 'desc', orgId?: string): Promise<{ total: number; page: number; offset: number; agents: any[]; }>; /** * Adds an existing Payment Plan to an AI Agent. * After this operation, users with access to the Payment Plan will be able to access the AI Agent. * * @remarks * Only the owner of the Payment Plan can call this method. * * @param planId - The unique identifier of the Payment Plan. * @param agentId - The unique identifier of the AI Agent. * @returns @see {@link NvmAPIResult} A promise that resolves indicating if the operation was successful. * @throws PaymentsError if unable to add the plan to the agent. * * @example * ``` * const result = await payments.agents.addPlanToAgent(planId, agentId) * // { * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535', * // success: true * // } * ``` */ addPlanToAgent(planId: string, agentId: string): Promise; /** * Removes a Payment Plan from an AI Agent. * After this operation, users with access to the Payment Plan will no longer be able to access the AI Agent. * * @remarks * Only the owner of the Payment Plan can call this method. * * @param planId - The unique identifier of the Payment Plan. * @param agentId - The unique identifier of the AI Agent. * @returns @see {@link NvmAPIResult} A promise that resolves indicating if the operation was successful. * @throws PaymentsError if unable to remove the plan from the agent. * * @example * ``` * const result = await payments.agents.removePlanFromAgent(planId, agentId) * // { * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535', * // success: true * // } * ``` */ removePlanFromAgent(planId: string, agentId: string): Promise; } //# sourceMappingURL=agents-api.d.ts.map