TypeScript Integration for AI Agents

Installation

# Using npm
npm install @trysiren/agent-toolkit

# Using yarn
yarn add @trysiren/agent-toolkit

Framework Integration

The toolkit is designed to work with any AI framework that supports function calling.

Framework-Specific Examples

Refer to our examples directory for detailed integration guides:
FrameworkExampleDescription
OpenAIView ExampleComplete OpenAI Assistant integration
LangChainView ExampleAgent with LangChain tools
Vercel AI SDKView ExampleNext.js and Vercel AI SDK integration
MastraView ExampleMastra integration

Requirements

  • Node.js v16 or higher
  • Siren API key (get one from Siren Dashboard)
  • Compatible AI framework with function calling support

Configuration

The toolkit uses a permission-based configuration system to control which Siren tools are available to your AI agents.

Basic Setup

import { SirenToolkit } from '@trysiren/agent-toolkit';

// Initialize with your API key
const toolkit = new SirenToolkit({
  apiKey: 'YOUR_SIREN_API_KEY',
  // Optional configuration
  actions: {
    messaging: { create: true, read: true },
    templates: { read: true }
  }
});

// Get tools for your AI framework
const tools = toolkit.getTools();

Configuration Options

The toolkit uses a TypeScript interface for strongly-typed configuration:
interface Configuration {
  actions?: {
    messaging?: {
      create?: boolean;    // Send messages
      read?: boolean;      // Get message status and replies
    };
    templates?: {
      create?: boolean;    // Create templates
      read?: boolean;      // List templates
      update?: boolean;    // Update templates
      delete?: boolean;    // Delete templates
    };
    // ... other action types
  };
  // Other configuration options
}

Available Tools

Messaging Tools

ToolDescriptionExample Use Case
send_messageSend a message through any channel”Send an email to the user”
get_message_statusCheck delivery status”Did my last message get delivered?”
list_messagesList sent messages with filters”Show me all failed SMS from yesterday”

Template Tools

ToolDescriptionExample Use Case
create_templateCreate a new message template”Create an email template for order confirmations”
get_templateGet template details”Show me the welcome email template”
list_templatesList available templates”What templates do we have?”
update_templateUpdate an existing template”Add a new variable to the password reset template”
delete_templateRemove a template”Delete the old holiday promotion template”

Workflow Tools

ToolDescriptionExample Use Case
trigger_workflowStart a workflow execution”Send the abandoned cart sequence”
get_workflow_statusCheck workflow status”Is the onboarding workflow complete?”
schedule_workflowSchedule workflows for future execution”Schedule a follow-up message for next week”

Webhook Configuration

ToolDescriptionExample Use Case
setup_webhookConfigure webhook endpoints”Forward all message status updates to our CRM”
list_webhooksView configured webhooks”What webhooks do we have set up?”
delete_webhookRemove a webhook”Remove the old test webhook”

Error Handling

The toolkit provides detailed error messages and TypeScript types for all operations. Always wrap API calls in try/catch blocks:
try {
  const result = await toolkit.sendMessage({
    channel: 'EMAIL',
    to: 'user@example.com',
    subject: 'Hello',
    body: 'This is a test message'
  });
  console.log('Message sent:', result.messageId);
} catch (error) {
  console.error('Failed to send message:', error.message);
  // Handle specific error types
  if (error.name === 'SirenAuthError') {
    // Handle authentication errors
  } else if (error.name === 'SirenRateLimitError') {
    // Handle rate limiting
  }
}

License

MIT