UNPKG

@artinet/sdk

Version:

A TypeScript SDK for building collaborative AI agents.

67 lines (66 loc) 1.76 kB
/** * Copyright 2025 The Artinet Project * SPDX-License-Identifier: Apache-2.0 */ export const isAgentCardParams = (params) => { return (typeof params === "string" || (typeof params === "object" && params !== null && "name" in params)); }; export class AgentCard { _agentCard; constructor(params) { this._agentCard = { protocolVersion: "0.3.0", description: "An agent that can use the A2A protocol.", url: "https://localhost:3000/a2a", version: "0.0.0", capabilities: {}, defaultInputModes: [], defaultOutputModes: [], skills: [], preferredTransport: "JSONRPC", ...params, }; } get agentCard() { return this._agentCard; } static create(params) { return new AgentCard(typeof params === "string" ? { name: params } : params) .agentCard; } } /** * @deprecated Use {@link card} instead * @since 0.6.0 */ export const AgentCardBuilder = AgentCard; /** * Convenience factory function for creating an {@link A2A.AgentCard} with default parameters. * * @returns New {@link A2A.AgentCard} with default parameters * @defaults { * description: "An agent that can use the A2A protocol.", * url: "https://localhost:3000/a2a", * version: "0.0.0", * capabilities: {}, * defaultInputModes: [], * defaultOutputModes: [], * skills: [], * preferredTransport: "JSONRPC", * } * * @example * ```typescript * const agentCard = card("My Agent"); * ``` * * @public * @since 0.6.0 */ export const card = AgentCard.create; /** * @deprecated Use {@link card} instead * @since 0.6.0 */ export const createAgentCard = AgentCard.create;