Demo Project — This repository is part of the Toolpack SDK ecosystem. It provides minimal, runnable examples demonstrating various integration patterns.
This directory contains minimal Node.js examples demonstrating various integration patterns with the Toolpack SDK.
samples/toolpack-sdk-integrations/
├── 01-basic-providers/ # Basic provider integrations
├── 02-multi-provider/ # Multi-provider setup
├── 03-custom-provider/ # Custom provider implementation
├── 04-tools-integration/ # Tool loading and usage
├── 05-modes-and-workflows/ # Mode-based execution
├── 06-streaming/ # Real-time streaming
├── 07-multimodal/ # Image and file handling
├── 08-embeddings/ # Text embeddings
├── 09-event-driven/ # Event handling
├── 10-advanced-config/ # Configuration patterns
├── 11-knowledge/ # Knowledge & RAG integrations
└── README.md # This file
-
Install dependencies (from SDK root):
npm install npm run build
-
Set up environment variables:
export TOOLPACK_OPENAI_KEY="sk-..." export TOOLPACK_ANTHROPIC_KEY="sk-ant-..." export TOOLPACK_GEMINI_KEY="AIza..."
-
Run any example:
cd samples/toolpack-sdk-integrations/01-basic-providers node openai.js
- openai.js - OpenAI/GPT integration
- anthropic.js - Anthropic/Claude integration
- gemini.js - Google Gemini integration
- ollama.js - Local Ollama models
- switch-providers.js - Dynamic provider switching
- list-models.js - Discover available models
- fallback-strategy.js - Provider fallback logic
- custom-adapter.js - Implement custom provider
- openai-compatible.js - OpenAI-compatible endpoints
- builtin-tools.js - Use built-in tools
- custom-tools.js - Create custom tools
- runtime-loading.js - Dynamic tool loading
- agent-mode.js - Autonomous agent execution
- workflow-planning.js - Multi-step workflows
- custom-mode.js - Define custom modes
- basic-streaming.js - Token-by-token streaming
- workflow-streaming.js - Stream workflow progress
- progress-tracking.js - Real-time progress events
- image-input.js - Process images (file, base64, URL)
- file-upload.js - Provider file upload API
- vision-models.js - Vision-capable models
- generate-embeddings.js - Create text embeddings
- similarity-search.js - Vector similarity
- status-events.js - Provider status tracking
- tool-events.js - Tool execution monitoring
- workflow-events.js - Workflow lifecycle events
- config-file.js - Use toolpack.config.json
- environment-vars.js - Environment-based config
- system-prompts.js - Custom system prompts
- persistent-cache.js - Build a Knowledge base with
PersistentKnowledgeProviderand skip re-embedding usingreSync: false - knowledge-search.js - Attach Knowledge to
Toolpack.init()so AI callsknowledge_searchwith cached docs
Each example may require different API keys:
# OpenAI
export TOOLPACK_OPENAI_KEY="sk-..."
# Anthropic
export TOOLPACK_ANTHROPIC_KEY="sk-ant-..."
# Google Gemini
export TOOLPACK_GEMINI_KEY="AIza..."
# Optional: Custom base URLs
export OPENAI_BASE_URL="https://api.openai.com/v1"
export OLLAMA_BASE_URL="http://localhost:11434"For complete API documentation, visit: Toolpack SDK Docs
- Start with
01-basic-providersto understand the fundamentals - Each example is self-contained and can run independently
- Check the comments in each file for detailed explanations
- Examples use ES modules - ensure your Node.js version supports them
Feel free to add more examples or improve existing ones!
Author: Sajeer