@artinet/sdk
Version:
A TypeScript SDK for building collaborative AI agents.
36 lines (35 loc) • 1.2 kB
TypeScript
/**
* Copyright 2025 The Artinet Project
* SPDX-License-Identifier: Apache-2.0
*/
import express from "express";
import { CorsOptions } from "cors";
import { ServerParams as BaseServerParams } from "../params.js";
export type ServerParams = BaseServerParams & {
app?: express.Express;
corsOptions?: CorsOptions;
};
/**
* @note Best used with the `cr8` builder.
* @param {ServerParams} params - The server parameters
* @returns {ExpressAgentServer} - The express agent server
* @example
* ```typescript
* const { app, agent, start } = serve({
* agent: cr8("MyAgent")
* .text("Hello, world!")
* .agent,
* basePath: "/a2a",
* });
* ```
*/
export declare function serve({ app, basePath, agentCardPath, agent, corsOptions, extendedAgentCard, register, port, userBuilder, }: ServerParams): {
app: express.Express;
agent: import("../../index.js").Agent;
start: (_port?: number) => import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
};
/**
* @deprecated Use `cr8.serve` instead.
*/
export declare const createAgentServer: typeof serve;
export type ExpressAgentServer = ReturnType<typeof serve>;