openai-swarmjs
Version:
Agentic framework inspired from OpenAI's swarm framework for TS, JS
41 lines (40 loc) • 1.34 kB
TypeScript
import { Agent, AgentFunction } from "../../core/types";
import { BaseAgent } from "../../core/BaseAgent";
export interface DagTask {
id: string;
type: 'function' | 'subdag';
functionName?: string;
functionArgs?: Record<string, any>;
subdag?: {
goal: string;
steps: DagTask[];
};
dependencies: string[];
}
export declare class DagCreationAgent extends BaseAgent {
private dagCreated;
private lastResponse;
private createdDag;
constructor(goal: string, functions: AgentFunction[]);
updateLastResponse(response: string): void;
shouldTransferManually(): boolean;
nextAgent(): Promise<Agent | null>;
getCreatedDag(): DagTask[] | null;
}
export declare class DagExecutionAgent extends BaseAgent {
private dagSteps;
private completedTasks;
private currentSubdag;
private executionResults;
constructor(goal: string, functions: AgentFunction[], dagSteps: DagTask[]);
private findTask;
private getExecutableTasks;
private resolveArguments;
markTaskCompleted(taskId: string, result: any): void;
shouldTransferManually(): boolean;
nextAgent(): Promise<Agent | null>;
isCompleted(): boolean;
}
export declare class MetaDagExecutionAgent extends DagExecutionAgent {
constructor(goal: string, functions: AgentFunction[]);
}