workflows.do
Version:
A framework and platform for building, deploying, and managing enterprise-grade AI workflows
80 lines (79 loc) • 2.3 kB
TypeScript
/**
* Workflows.do SDK
* A framework for building, deploying, and managing enterprise-grade AI workflows
*/
export interface AIConfig {
[key: string]: (context: WorkflowContext) => Promise<any>;
}
export interface WorkflowContext {
ai: AICapabilities;
api: APIIntegrations;
db: DatabaseOperations;
event: any;
}
export interface AICapabilities {
[key: string]: (params: any) => Promise<any>;
}
export interface APIIntegrations {
[key: string]: any;
}
export interface DatabaseOperations {
[key: string]: any;
}
export interface WorkflowConfig {
name: string;
description?: string;
steps: Record<string, WorkflowStep>;
triggers?: string[];
timeout?: number;
}
export interface WorkflowStep {
type?: 'action' | 'decision' | 'parallel' | 'wait' | 'terminal';
action?: string;
next?: string | Record<string, string>;
onError?: string;
retry?: RetryConfig;
branches?: Record<string, string>;
joinCondition?: 'all' | 'any' | 'n' | ((results: any) => boolean);
result?: any;
}
export interface RetryConfig {
maxAttempts: number;
backoff: 'fixed' | 'exponential' | 'linear';
initialDelay: number;
}
export interface IntegrationConfig {
name: string;
actions: Record<string, (params: any) => Promise<any>>;
events?: string[];
}
/**
* Create an AI-powered workflow
* @param config The workflow configuration
* @returns The configured workflow
*/
export declare function AI(config: AIConfig): AIConfig;
/**
* Define a new workflow
* @param config The workflow configuration
* @returns The configured workflow
*/
export declare function defineWorkflow(config: WorkflowConfig): WorkflowConfig;
/**
* Create an integration with external services
* @param config The integration configuration
* @returns The configured integration
*/
export declare function defineIntegration(config: IntegrationConfig): IntegrationConfig;
/**
* Define an event trigger for workflows
* @param config The trigger configuration
* @returns The configured trigger
*/
export declare function defineTrigger(config: any): any;
/**
* Create a reusable action for workflow steps
* @param config The action configuration
* @returns The configured action
*/
export declare function defineAction(config: any): any;