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.
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
| Language | Minimum Version | Required Peers |
|---|---|---|
| JavaScript/TS | Node.js 18+ | fetch API (native or polyfill) |
| Python | Python 3.9+ | aiodns, cryptography |
| Rust | Rust 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);
--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:
| Variable | Description | Default |
|---|---|---|
NEXUS_AI_KEY | Primary API authentication token | Required |
NEXUS_AI_REGION | Deployment region for inference | us-east-1 |
NEXUS_AI_LOG_LEVEL | SDK logging verbosity | warn |
NEXUS_AI_TIMEOUT | Request timeout in milliseconds | 30000 |
NEXUS_AI_MAX_RETRIES | Automatic retry count on 5xx errors | 3 |
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.
- Single-Step Agents: Execute one inference cycle and return results. Ideal for classification, extraction, and simple Q&A.
- Multi-Step Agents: Iterate through reasoning, tool calls, and reflection until a success condition is met or max iterations are reached.
- Orchestrator Pattern: A supervisor agent delegates tasks to specialized worker agents and aggregates results.
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:
- Agent Orchestration Patterns — Designing reliable multi-agent systems
- Custom Tool Development — Extend agents with your APIs and internal services
- Evaluation & Testing — Benchmarking agent performance and reliability
- Production Deployment — Scaling, monitoring, and cost optimization