Getting Started

Welcome to the NexusAI documentation. This guide covers everything you need to integrate NexusAI into your applications, configure your workspace, and leverage our autonomous agent framework for production-scale AI workloads.

💡 New to NexusAI? Start with the Quick Start guide to spin up your first AI agent in under 2 minutes. For production deployments, review our Security Best Practices first.

Installation

The NexusAI SDK is available for JavaScript/TypeScript, Python, and Rust. Install via your preferred package manager:

# npm / yarn
npm install @nexusai/sdk

# pip
pip install nexus-ai

# cargo
cargo add nexus-ai-rs

Peer Dependencies

LanguageMinimum VersionRequired Peers
JavaScript/TSNode.js 18+fetch API (native or polyfill)
PythonPython 3.9+aiodns, cryptography
RustRust 1.70+tokio, reqwest

Quick Start

Initialize your first autonomous AI agent in under 30 seconds. The following example demonstrates a research agent with tool access:

import { NexusAI, Agent } from '@nexusai/sdk';

// Initialize with your API key
const nexus = new NexusAI({
  apiKey: process.env.NEXUS_AI_KEY,
  region: 'us-east-1'
});

// Create an autonomous agent
const researcher = new Agent({
  name: 'financial-analyst',
  model: 'nexus-v3-ultra',
  systemPrompt: `You are a senior financial analyst. Extract key metrics, identify trends, and output structured JSON. Always cite sources.`,
  tools: ['web-search', 'pdf-parser', 'code-executor'],
  maxIterations: 5
});

async function main() {
  const result = await researcher.run(
    'Analyze the attached Q3 earnings report. Highlight revenue growth, margin changes, and forward guidance.'
  );
  
  console.log('Analysis:', result.output);
  console.log('Sources:', result.sources);
  console.log('Token Usage:', result.metadata.tokens);
}

main().catch(console.error);
⚠️ Development Tip Use the --dry-run flag or set NEXUS_AI_DRY_RUN=true to simulate agent execution without consuming API credits or making external tool calls.

Configuration

Environment Variables

NexusAI respects standard environment variables for authentication, routing, and observability:

VariableDescriptionDefault
NEXUS_AI_KEYPrimary API authentication tokenRequired
NEXUS_AI_REGIONDeployment region for inferenceus-east-1
NEXUS_AI_LOG_LEVELSDK logging verbositywarn
NEXUS_AI_TIMEOUTRequest timeout in milliseconds30000
NEXUS_AI_MAX_RETRIESAutomatic retry count on 5xx errors3

Programmatic Configuration

You can override environment variables at runtime:

const nexus = new NexusAI({
  apiKey: 'sk-nx-prod-xxxx',
  region: 'eu-west-1',
  timeout: 45000,
  logger: {
    level: 'debug',
    format: 'json',
    destination: process.stdout
  }
});

Core Concepts: Agents & Workflows

NexusAI's agent architecture is built on a state-machine foundation with dynamic tool routing. Each agent operates within a defined context window and can execute multi-step reasoning loops.

Memory & Context Management

Context is managed through a hybrid memory system:

const agent = new Agent({
  memory: {
    type: 'hybrid',
    shortTerm: { maxSize: 4000 }, // Token limit
    longTerm: {
      storage: 'vector-db',
      collection: 'project-research',
      similarityThreshold: 0.75
    }
  }
});

Next Steps

Now that you understand the basics, explore these resources: