crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
70 lines • 1.78 kB
TypeScript
/**
* PostgreSQL Search Tool
* Provides optimized database search capabilities for agents
* with connection pooling and memory-efficient result handling
*/
/**
* Result of a PostgreSQL search operation
*/
export interface PGSearchResult {
rows: Record<string, any>[];
rowCount: number | null;
fields: Array<{
name: string;
dataTypeID: number;
tableID: number;
}> | null;
command: string;
duration: number;
error?: string;
}
/**
* Options for configuring the PGSearchTool
*/
export interface PGSearchToolOptions {
/**
* Default connection string to use if not provided in the input
*/
defaultConnectionString?: string;
/**
* Whether to automatically parse JSON columns
* @default true
*/
parseJson?: boolean;
/**
* Maximum number of rows to return
* @default 1000
*/
maxRows?: number;
/**
* Whether to cache query results
* @default false
*/
cacheResults?: boolean;
/**
* Cache expiration time in milliseconds
* @default 60000 (1 minute)
*/
cacheExpiration?: number;
/**
* Maximum query execution time in milliseconds
* @default 30000 (30 seconds)
*/
queryTimeout?: number;
}
/**
* Creates an optimized PostgreSQL search tool
*/
export declare function createPGSearchTool(options?: PGSearchToolOptions): import("../StructuredTool.js").StructuredTool<{
timeout?: number;
query?: string;
params?: any[];
connectionString?: string;
rowLimit?: number;
}, PGSearchResult>;
/**
* Cleanup PostgreSQL connections
* Call this when shutting down your application
*/
export declare function cleanupPGConnections(): Promise<void>;
//# sourceMappingURL=PGSearchTool.d.ts.map