> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trysiren.io/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript

> Integrate Siren with TypeScript/JavaScript-based AI agents using our SDK

# TypeScript Integration for AI Agents

## Installation

```bash theme={null}
# 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](https://github.com/KeyValueSoftwareSystems/siren-agent-toolkit/tree/main/typescript/examples) for detailed integration guides:

| Framework     | Example                                                                                                                | Description                           |
| ------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| OpenAI        | [View Example](https://github.com/KeyValueSoftwareSystems/siren-agent-toolkit/tree/main/typescript/examples/openai)    | Complete OpenAI Assistant integration |
| LangChain     | [View Example](https://github.com/KeyValueSoftwareSystems/siren-agent-toolkit/tree/main/typescript/examples/langchain) | Agent with LangChain tools            |
| Vercel AI SDK | [View Example](https://github.com/KeyValueSoftwareSystems/siren-agent-toolkit/tree/main/typescript/examples/ai-sdk)    | Next.js and Vercel AI SDK integration |
| Mastra        | [View Example](https://github.com/KeyValueSoftwareSystems/siren-agent-toolkit/tree/main/typescript/examples/mastra)    | Mastra integration                    |

## Requirements

* Node.js v16 or higher
* Siren API key (get one from [Siren Dashboard](https://app.trysiren.io))
* 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

```typescript theme={null}
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:

```typescript theme={null}
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

| Tool                 | Description                        | Example Use Case                        |
| -------------------- | ---------------------------------- | --------------------------------------- |
| `send_message`       | Send a message through any channel | "Send an email to the user"             |
| `get_message_status` | Check delivery status              | "Did my last message get delivered?"    |
| `list_messages`      | List sent messages with filters    | "Show me all failed SMS from yesterday" |

### Template Tools

| Tool              | Description                   | Example Use Case                                    |
| ----------------- | ----------------------------- | --------------------------------------------------- |
| `create_template` | Create a new message template | "Create an email template for order confirmations"  |
| `get_template`    | Get template details          | "Show me the welcome email template"                |
| `list_templates`  | List available templates      | "What templates do we have?"                        |
| `update_template` | Update an existing template   | "Add a new variable to the password reset template" |
| `delete_template` | Remove a template             | "Delete the old holiday promotion template"         |

### Workflow Tools

| Tool                  | Description                             | Example Use Case                             |
| --------------------- | --------------------------------------- | -------------------------------------------- |
| `trigger_workflow`    | Start a workflow execution              | "Send the abandoned cart sequence"           |
| `get_workflow_status` | Check workflow status                   | "Is the onboarding workflow complete?"       |
| `schedule_workflow`   | Schedule workflows for future execution | "Schedule a follow-up message for next week" |

### Webhook Configuration

| Tool             | Description                 | Example Use Case                                |
| ---------------- | --------------------------- | ----------------------------------------------- |
| `setup_webhook`  | Configure webhook endpoints | "Forward all message status updates to our CRM" |
| `list_webhooks`  | View configured webhooks    | "What webhooks do we have set up?"              |
| `delete_webhook` | Remove a webhook            | "Remove the old test webhook"                   |

## License

[MIT](https://github.com/trysiren/agent-toolkit/blob/main/LICENSE)
