@runflow-ai/sdk 1.0.67 → 1.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Runflow SDK is a comprehensive, type-safe framework for building AI agents, comp
|
|
|
13
13
|
|
|
14
14
|
- 🤖 **Intelligent Agents** - Create agents with LLM, tools, memory, and RAG capabilities
|
|
15
15
|
- 🔧 **Type-Safe Tools** - Build custom tools with Zod schema validation
|
|
16
|
-
- 🔌 **
|
|
16
|
+
- 🔌 **Dynamic Connectors** - Connect to any API with runtime schema loading
|
|
17
17
|
- 🌊 **Workflows** - Orchestrate complex multi-step processes with conditional logic
|
|
18
18
|
- 🧠 **Memory Management** - Persistent conversation history with automatic summarization
|
|
19
19
|
- 📚 **Agentic RAG** - LLM-driven semantic search in vector knowledge bases
|
|
@@ -768,8 +768,7 @@ const createTicketTool = createTool({
|
|
|
768
768
|
// Use connector
|
|
769
769
|
const ticket = await runflow.connector(
|
|
770
770
|
'hubspot',
|
|
771
|
-
'
|
|
772
|
-
'create',
|
|
771
|
+
'create-ticket', // resource slug
|
|
773
772
|
{
|
|
774
773
|
subject: context.subject,
|
|
775
774
|
content: context.description,
|
|
@@ -2691,8 +2690,7 @@ Complete, production-ready examples showcasing the platform's potential.
|
|
|
2691
2690
|
A sophisticated support agent that searches documentation, remembers context, and creates tickets in HubSpot.
|
|
2692
2691
|
|
|
2693
2692
|
```typescript
|
|
2694
|
-
import { Agent, openai, createTool } from '@runflow-ai/sdk';
|
|
2695
|
-
import { hubspotConnector } from '@runflow-ai/sdk/connectors';
|
|
2693
|
+
import { Agent, openai, createTool, createConnectorTool } from '@runflow-ai/sdk';
|
|
2696
2694
|
import { z } from 'zod';
|
|
2697
2695
|
|
|
2698
2696
|
// Create a support agent with memory and RAG
|
|
@@ -2714,7 +2712,7 @@ const supportAgent = new Agent({
|
|
|
2714
2712
|
},
|
|
2715
2713
|
|
|
2716
2714
|
// Search in documentation
|
|
2717
|
-
|
|
2715
|
+
rag: {
|
|
2718
2716
|
vectorStore: 'support-docs',
|
|
2719
2717
|
k: 5,
|
|
2720
2718
|
threshold: 0.7,
|
|
@@ -2722,7 +2720,11 @@ const supportAgent = new Agent({
|
|
|
2722
2720
|
|
|
2723
2721
|
// Available tools
|
|
2724
2722
|
tools: {
|
|
2725
|
-
createTicket:
|
|
2723
|
+
createTicket: createConnectorTool({
|
|
2724
|
+
connector: 'hubspot',
|
|
2725
|
+
resource: 'create-ticket',
|
|
2726
|
+
description: 'Create a support ticket in HubSpot',
|
|
2727
|
+
}),
|
|
2726
2728
|
searchOrders: createTool({
|
|
2727
2729
|
id: 'search-orders',
|
|
2728
2730
|
description: 'Search customer orders',
|
|
@@ -2730,7 +2732,7 @@ const supportAgent = new Agent({
|
|
|
2730
2732
|
customerId: z.string(),
|
|
2731
2733
|
}),
|
|
2732
2734
|
execute: async ({ context }) => {
|
|
2733
|
-
const orders = await fetchOrders(context.
|
|
2735
|
+
const orders = await fetchOrders(context.customerId);
|
|
2734
2736
|
return { orders };
|
|
2735
2737
|
},
|
|
2736
2738
|
}),
|
|
@@ -2754,7 +2756,6 @@ Automate lead qualification, deal creation, and team notifications using workflo
|
|
|
2754
2756
|
|
|
2755
2757
|
```typescript
|
|
2756
2758
|
import { createWorkflow, Agent, openai } from '@runflow-ai/sdk';
|
|
2757
|
-
import { hubspotConnector, slackConnector } from '@runflow-ai/sdk/connectors';
|
|
2758
2759
|
import { z } from 'zod';
|
|
2759
2760
|
|
|
2760
2761
|
// Qualification agent
|
|
@@ -2896,8 +2897,7 @@ console.log('Workflow completed:', result);
|
|
|
2896
2897
|
Automate debt collection with personalized WhatsApp messages using context-aware AI.
|
|
2897
2898
|
|
|
2898
2899
|
```typescript
|
|
2899
|
-
import { Agent, openai, Runflow } from '@runflow-ai/sdk';
|
|
2900
|
-
import { twilioConnector } from '@runflow-ai/sdk/connectors';
|
|
2900
|
+
import { Agent, openai, Runflow, createTool, createConnectorTool } from '@runflow-ai/sdk';
|
|
2901
2901
|
import { z } from 'zod';
|
|
2902
2902
|
|
|
2903
2903
|
// Collections agent with empathy and context
|
|
@@ -2916,7 +2916,11 @@ const collectionsAgent = new Agent({
|
|
|
2916
2916
|
},
|
|
2917
2917
|
|
|
2918
2918
|
tools: {
|
|
2919
|
-
sendWhatsApp:
|
|
2919
|
+
sendWhatsApp: createConnectorTool({
|
|
2920
|
+
connector: 'twilio',
|
|
2921
|
+
resource: 'send-whatsapp',
|
|
2922
|
+
description: 'Send WhatsApp message via Twilio',
|
|
2923
|
+
}),
|
|
2920
2924
|
getPaymentHistory: createTool({
|
|
2921
2925
|
id: 'get-payment-history',
|
|
2922
2926
|
description: 'Get customer payment history',
|
|
@@ -2924,7 +2928,7 @@ const collectionsAgent = new Agent({
|
|
|
2924
2928
|
customerId: z.string(),
|
|
2925
2929
|
}),
|
|
2926
2930
|
execute: async ({ context }) => {
|
|
2927
|
-
const history = await fetchPaymentHistory(context.
|
|
2931
|
+
const history = await fetchPaymentHistory(context.customerId);
|
|
2928
2932
|
return { history };
|
|
2929
2933
|
},
|
|
2930
2934
|
}),
|
|
@@ -2966,8 +2970,8 @@ for (const invoice of overdueInvoices) {
|
|
|
2966
2970
|
Guide new users through onboarding with an interactive, multi-turn conversation.
|
|
2967
2971
|
|
|
2968
2972
|
```typescript
|
|
2969
|
-
import { Agent, openai } from '@runflow-ai/sdk';
|
|
2970
|
-
import {
|
|
2973
|
+
import { Agent, openai, createTool, createConnectorTool } from '@runflow-ai/sdk';
|
|
2974
|
+
import { z } from 'zod';
|
|
2971
2975
|
|
|
2972
2976
|
const onboardingAgent = new Agent({
|
|
2973
2977
|
name: 'Onboarding Assistant',
|
|
@@ -2986,14 +2990,22 @@ const onboardingAgent = new Agent({
|
|
|
2986
2990
|
summarizePrompt: 'Summarize onboarding progress, completed steps, and next actions',
|
|
2987
2991
|
},
|
|
2988
2992
|
|
|
2989
|
-
|
|
2993
|
+
rag: {
|
|
2990
2994
|
vectorStore: 'onboarding-docs',
|
|
2991
2995
|
k: 3,
|
|
2992
2996
|
},
|
|
2993
2997
|
|
|
2994
2998
|
tools: {
|
|
2995
|
-
sendEmail:
|
|
2996
|
-
|
|
2999
|
+
sendEmail: createConnectorTool({
|
|
3000
|
+
connector: 'email',
|
|
3001
|
+
resource: 'send-message',
|
|
3002
|
+
description: 'Send email to user',
|
|
3003
|
+
}),
|
|
3004
|
+
notifyTeam: createConnectorTool({
|
|
3005
|
+
connector: 'slack',
|
|
3006
|
+
resource: 'send-message',
|
|
3007
|
+
description: 'Notify team on Slack',
|
|
3008
|
+
}),
|
|
2997
3009
|
markStepComplete: createTool({
|
|
2998
3010
|
id: 'mark-step-complete',
|
|
2999
3011
|
description: 'Mark an onboarding step as complete',
|
|
@@ -3003,8 +3015,8 @@ const onboardingAgent = new Agent({
|
|
|
3003
3015
|
}),
|
|
3004
3016
|
execute: async ({ context }) => {
|
|
3005
3017
|
await updateOnboardingProgress(
|
|
3006
|
-
context.
|
|
3007
|
-
context.
|
|
3018
|
+
context.userId,
|
|
3019
|
+
context.stepName
|
|
3008
3020
|
);
|
|
3009
3021
|
return { success: true };
|
|
3010
3022
|
},
|
|
@@ -3038,7 +3050,6 @@ Collect customer feedback, analyze sentiment, and create actionable tickets.
|
|
|
3038
3050
|
|
|
3039
3051
|
```typescript
|
|
3040
3052
|
import { createWorkflow, Agent, openai } from '@runflow-ai/sdk';
|
|
3041
|
-
import { hubspotConnector, slackConnector } from '@runflow-ai/sdk/connectors';
|
|
3042
3053
|
import { z } from 'zod';
|
|
3043
3054
|
|
|
3044
3055
|
// Sentiment analyzer
|
|
@@ -3157,7 +3168,7 @@ const supportAgent = new Agent({
|
|
|
3157
3168
|
name: 'Technical Support',
|
|
3158
3169
|
instructions: 'You are a technical support expert. Help with technical issues.',
|
|
3159
3170
|
model: openai('gpt-4o'),
|
|
3160
|
-
|
|
3171
|
+
rag: { vectorStore: 'tech-docs', k: 5 },
|
|
3161
3172
|
});
|
|
3162
3173
|
|
|
3163
3174
|
const billingAgent = new Agent({
|
|
@@ -3381,7 +3392,7 @@ import type { MemoryProvider, KnowledgeProvider, LLMProvider } from '@runflow-ai
|
|
|
3381
3392
|
```typescript
|
|
3382
3393
|
interface AgentInput {
|
|
3383
3394
|
message: string;
|
|
3384
|
-
companyId
|
|
3395
|
+
companyId?: string;
|
|
3385
3396
|
userId?: string;
|
|
3386
3397
|
sessionId?: string;
|
|
3387
3398
|
executionId?: string;
|
|
@@ -3389,6 +3400,7 @@ interface AgentInput {
|
|
|
3389
3400
|
entityType?: string;
|
|
3390
3401
|
entityValue?: string;
|
|
3391
3402
|
channel?: string;
|
|
3403
|
+
file?: MediaFile;
|
|
3392
3404
|
messages?: Message[];
|
|
3393
3405
|
metadata?: Record<string, any>;
|
|
3394
3406
|
}
|
|
@@ -3400,16 +3412,18 @@ interface AgentOutput {
|
|
|
3400
3412
|
|
|
3401
3413
|
interface AgentConfig {
|
|
3402
3414
|
name: string;
|
|
3403
|
-
instructions: string;
|
|
3415
|
+
instructions: string | PromptRef; // Accepts string or loadPrompt() reference
|
|
3404
3416
|
model: ModelProvider;
|
|
3405
3417
|
modelConfig?: ModelConfig;
|
|
3406
3418
|
tools?: Record<string, RunflowTool>;
|
|
3407
3419
|
maxToolIterations?: number;
|
|
3408
3420
|
rag?: RAGConfig;
|
|
3409
3421
|
memory?: MemoryConfig;
|
|
3422
|
+
media?: MediaConfig;
|
|
3410
3423
|
streaming?: StreamingConfig;
|
|
3411
3424
|
agents?: Record<string, AgentConfig>;
|
|
3412
3425
|
debug?: boolean | DebugConfig;
|
|
3426
|
+
observability?: ObservabilityMode | ObservabilityConfig;
|
|
3413
3427
|
}
|
|
3414
3428
|
|
|
3415
3429
|
interface ModelConfig {
|