Open-Dedalus TypeScript Examples

August 23, 2025 ยท View on GitHub

This directory contains TypeScript examples demonstrating various features of the Open-Dedalus SDK.

Prerequisites

  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your API keys
  1. Build the project:
npm run build

Running Examples

1. Hello World (01_hello_world.ts)

Basic chat completion with Dedalus:

npx ts-node examples/01_hello_world.ts

2. Basic Tools (02_basic_tools.ts)

Tool execution with simple mathematical functions:

npx ts-node examples/02_basic_tools.ts

3. Streaming (03_streaming.ts)

Streaming responses with real-time output:

npx ts-node examples/03_streaming.ts

4. MCP Integration (04_mcp_integration.ts)

Integration with Model Context Protocol servers:

npx ts-node examples/04_mcp_integration.ts

Note: MCP integration is placeholder in TypeScript SDK

5. Model Handoffs (06_model_handoffs.ts)

Multi-model routing and intelligent handoffs:

npx ts-node examples/06_model_handoffs.ts

6. Tool Chaining (07_tool_chaining.ts)

Advanced multi-step tool execution workflows:

npx ts-node examples/07_tool_chaining.ts

7. Policy (08_policy.ts)

Dynamic behavior control with custom policies:

npx ts-node examples/08_policy.ts

Environment Variables

Create a .env file with your API keys:

# Required for OpenAI models
OPENAI_API_KEY=your_openai_key_here

# Required for Anthropic models  
ANTHROPIC_API_KEY=your_anthropic_key_here

# Optional - other providers
GOOGLE_API_KEY=your_google_key_here
FIREWORKS_API_KEY=your_fireworks_key_here
# ... etc

Notes

  • Examples require Node.js 18+ and TypeScript
  • Some examples use models like gpt-4.1 that may not be available
  • MCP integration is placeholder and will be implemented in future versions
  • Tool execution requires appropriate model capabilities (newer models work better)