Introduction

Suada provides official backend SDKs to help you integrate AI-powered chat and analysis capabilities into your server-side applications. Our SDKs are designed with developer experience in mind, offering type safety, comprehensive documentation, and intuitive APIs.

Available SDKs

Core Features

🔐 Authentication & Security

Both SDKs support secure authentication using API keys and include privacy features:

import { Suada } from '@suada/node';

const suada = new Suada({
  apiKey: process.env.SUADA_API_KEY,
  privacyMode: true  // Optional enhanced security
});

🤖 LangChain Integration

Both SDKs provide seamless integration with LangChain for advanced AI capabilities:

import { Suada } from '@suada/node';
import { AgentExecutor, createOpenAIFunctionsAgent } from 'langchain/agents';
import { ChatOpenAI } from 'langchain/chat_models/openai';

const suada = new Suada({
  apiKey: process.env.SUADA_API_KEY
});

const suadaTool = suada.createTool({
  name: 'business_analyst',
  description: 'Use this tool for business insights'
});

const agent = await createOpenAIFunctionsAgent({
  llm: new ChatOpenAI({ temperature: 0 }),
  tools: [suadaTool]
});

const executor = AgentExecutor.fromAgentAndTools({
  agent,
  tools: [suadaTool]
});

💬 Chat Interface

The chat endpoint is the primary way to interact with Suada. Both SDKs provide a consistent response format:

interface SuadaResponse {
    // Main response text
    answer: string;
    
    // Optional fields
    thoughts?: string;
    actions?: Array<{
        tool: string;
        toolInput: string;
        log: string;
    }>;
    followUpQuestion?: string;
    reasoning?: string;
    sources?: string[];
    conversationId?: string;
    timestamp: number;
}

👤 User Context Management

Both SDKs support passthrough mode for integrating with your application’s user system:

const suada = new Suada({
  apiKey: process.env.SUADA_API_KEY,
  passthroughMode: true
});

const response = await suada.chat({
  message: "What's our performance?",
  externalUserIdentifier: "user-123"
});

Key Benefits

Type Safety

  • Built-in TypeScript definitions (Node.js)
  • Pydantic model validation (Python)
  • IDE autocompletion support
  • Runtime type checking

LangChain Support

  • Tool creation for LangChain agents
  • Memory management for conversations
  • Custom agent configurations
  • Structured prompt templates

Error Handling

  • Structured error types
  • Detailed error messages
  • Automatic retry mechanisms
  • Rate limit handling

Performance

  • Connection pooling
  • Automatic retries
  • Concurrent request support
  • Efficient resource management

Security

  • Secure API key handling
  • Privacy mode option
  • User isolation in passthrough mode
  • Rate limiting protection

Getting Started

  1. Choose Your SDK

    • Node.js: Modern JavaScript/TypeScript applications and web backends
    • Python: Data science, AI/ML, or Python web applications
  2. Installation

    # Node.js
    npm install @suada/node langchain
    
    # Python
    pip install suada langchain
  3. Configure Environment

    # .env file
    SUADA_API_KEY=your-api-key
    OPENAI_API_KEY=your-openai-key  # Required for LangChain integration
  4. Initialize Client

    • Follow SDK-specific initialization
    • Configure optional features
    • Set up error handling
    • Initialize LangChain tools if needed
  5. Make Your First Request

    • Send a test message
    • Handle the response
    • Implement error handling

Best Practices

Security

  • Store API keys in environment variables
  • Enable privacy mode for sensitive data
  • Implement proper error handling
  • Use secure user identification

LangChain Integration

  • Use clear tool descriptions
  • Implement proper memory management
  • Handle agent errors gracefully
  • Monitor agent performance

Performance

  • Reuse SDK and agent instances
  • Implement appropriate timeouts
  • Handle rate limits gracefully
  • Use async/await where available

Development

  • Use type checking tools
  • Write comprehensive tests
  • Follow SDK-specific conventions
  • Keep dependencies updated

FAQ

Which SDK should I choose?

  • Choose Node.js for JavaScript/TypeScript applications and modern web backends
  • Choose Python for data science, AI/ML applications, or Python web services

How do I handle rate limits?

Both SDKs implement automatic exponential backoff. You can customize retry behavior through configuration options.

Can I use the SDKs in serverless environments?

Yes, both SDKs are compatible with serverless environments like AWS Lambda, Google Cloud Functions, and Vercel.

How do I debug SDK issues?

Both SDKs provide detailed logging options:

  • Node.js: Debug environment variable
  • Python: Standard logging module

Is local development supported?

Yes, both SDKs support local development with:

  • Custom base URLs
  • Debug logging
  • Test environments
  • Mock responses

Support & Resources

Documentation

Support