agentswarm
Version:
LLM-agnostic typescript framework for creating OpenAI-style Swarm agents with the Vercel AI SDK
30 lines (29 loc) • 1.1 kB
TypeScript
import type { LanguageModel } from 'ai';
import type { Agent } from './agent';
import { Swarm, type SwarmMessage } from './swarm';
export type HiveOptions<HIVE_CONTEXT extends object> = {
defaultModel?: LanguageModel;
queen: Agent<HIVE_CONTEXT>;
defaultContext?: HIVE_CONTEXT;
};
export type HiveCreateSwarmOptions<SWARM_CONTEXT extends object> = {
defaultModel?: LanguageModel;
messages?: Array<SwarmMessage>;
queen?: Agent<SWARM_CONTEXT>;
defaultContext?: SWARM_CONTEXT;
};
/**
* A **Hive** represents something like a "Swarm Factory". It looks like a static configuration, from which new
* **Swarm**s can be created with their own internal state and context.
*/
export declare class Hive<HIVE_CONTEXT extends object = any> {
private readonly defaultModel;
readonly queen: Agent<HIVE_CONTEXT>;
readonly defaultInitialContext?: HIVE_CONTEXT;
constructor(options: HiveOptions<HIVE_CONTEXT>);
/**
* Spawn a swarm from the hive
* @param options
*/
spawnSwarm(options?: HiveCreateSwarmOptions<HIVE_CONTEXT>): Swarm<HIVE_CONTEXT>;
}