crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
90 lines • 2.82 kB
TypeScript
/**
* Crew Agent Executor Mixin
* Handles agent execution with memory management and human feedback capabilities
* Optimized for performance and memory efficiency
*/
import { BaseAgent } from '../BaseAgent.js';
import { Task } from '../../task/Task.js';
/**
* Options for the executor mixin
*/
export interface ExecutorOptions {
/** Whether to enable memory storage */
memory?: boolean;
/** Whether to enable human feedback */
humanInTheLoop?: boolean;
/** Number of iterations before stopping */
maxIterations?: number;
/** Whether to enable training mode */
trainingMode?: boolean;
/** Custom printer implementation */
printer?: any;
}
/**
* Executor result type
*/
export interface ExecutorResult {
text: string;
[key: string]: any;
}
/**
* Crew Agent Executor Mixin
*
* This mixin provides memory management and human feedback functionality
* for agent execution with performance optimizations.
*/
export declare class CrewAgentExecutorMixin {
private crew;
private agent;
private task;
private iterations;
private maxIterations;
private memoryEnabled;
private humanInTheLoop;
private trainingMode;
private printer;
/**
* Constructor for the executor mixin
* @param agent Agent being executed
* @param task Task being executed
* @param crew Crew the agent belongs to (optional)
* @param options Execution options
*/
constructor(agent: BaseAgent, task: Task, crew?: any, options?: ExecutorOptions);
/**
* Process the execution result
* Updates memory and handles human feedback
* @param result Execution result
* @returns The processed result
*/
processResult(result: ExecutorResult): Promise<ExecutorResult>;
/**
* Create and save a short-term memory item if conditions are met
* Optimized with error handling and validation
* @param output Execution output
*/
private createShortTermMemory;
/**
* Create and save long-term and entity memory items based on evaluation
* Optimized for async operations and error handling
* @param output Execution output
*/
private createLongTermMemory;
/**
* Prompt human input with mode-appropriate messaging
* @param finalAnswer Final answer to present to the human
* @returns Human feedback or empty string if no feedback
*/
private askHumanInput;
/**
* Get the current iteration count
* @returns Number of iterations executed
*/
getIterations(): number;
/**
* Check if the execution has reached the maximum number of iterations
* @returns True if max iterations reached, false otherwise
*/
hasReachedMaxIterations(): boolean;
}
//# sourceMappingURL=CrewAgentExecutorMixin.d.ts.map