UNPKG

@artinet/sdk

Version:

A TypeScript SDK for building collaborative AI agents.

22 lines (21 loc) 745 B
import { Service, createAgent, } from "../services/a2a/index.js"; export function isCreateAgentParams(agentOrParams) { return (agentOrParams && typeof agentOrParams === "object" && "engine" in agentOrParams && typeof agentOrParams.engine === "function" && "agentCard" in agentOrParams && typeof agentOrParams.agentCard === "object"); } export function ensureAgent(agentOrParams) { if (agentOrParams instanceof Service) { return agentOrParams; } else if (isCreateAgentParams(agentOrParams)) { return createAgent(agentOrParams); } throw new Error("invalid agent or params"); } export async function registerAgent(agentCard) { return Promise.resolve(agentCard); }