TypeScript SDK
PraisonAI TypeScript SDK – Complete AI Agent Framework
PraisonAI TypeScript SDK
The PraisonAI TypeScript SDK provides a complete framework for building AI agents, workflows, and applications.
Installation
npm install praisonai
# or
pnpm add praisonaiSupports both ESM (import) and CommonJS (require). See Packaging & Bundlers for bundler and React Native setup.
Quick Start
import { Agent, createAgent } from 'praisonai';
// Create a simple agent
const agent = createAgent({
name: 'Assistant',
instructions: 'You are a helpful assistant.',
llm: 'openai/gpt-4o-mini'
});
// Chat with the agent
const response = await agent.chat('Hello!');
console.log(response.text);Features
Core Features
- Agents – Create and manage AI agents
- Workflows – Multi-agent orchestration
- Tools – Extend agent capabilities
- Memory – Persistent conversation memory
- Sessions – Conversation management
Specialized Agents
- AutoAgents – Auto-generate agents from topics
- ImageAgent – Image generation and analysis
- DeepResearchAgent – Comprehensive research
- QueryRewriterAgent – Query optimization
- PromptExpanderAgent – Prompt enhancement
- RouterAgent – Request routing
- ContextAgent – Context management
Advanced Features
- Handoff – Agent-to-agent handoff
- Guardrails – Content validation
- Planning – Task planning
- Telemetry – Usage monitoring
Integrations
- Vector Stores – Embedding databases
- Observability – Monitoring and tracing
- Voice – TTS and STT
- Reranker – Document reranking
- GraphRAG – Graph-based RAG
- Cache – Response caching
- Database Adapters – Persistence
CLI
The SDK includes a full CLI. See TypeScript CLI Reference.
# Install globally
npm install -g praisonai
# Use the CLI
praisonai-ts chat "Hello!"
praisonai-ts auto "Build a web scraper"
praisonai-ts research "AI trends 2024"LLM Providers
import { createProvider, getAvailableProviders } from 'praisonai';
// List available providers
const providers = getAvailableProviders();
// Create a provider
const openai = createProvider('openai/gpt-4o-mini');
const anthropic = createProvider('anthropic/claude-3-sonnet');
const google = createProvider('google/gemini-pro');Environment Variables
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
PRAISONAI_MODEL=openai/gpt-4o-mini