Skip to content

Modern multi-agent AI reasoning system with TypeScript, Next.js, and extensible architecture. Supports OpenAI, Ollama, and custom model providers.

License

Notifications You must be signed in to change notification settings

jakubkunert/PolarisAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PolarisAI - Multi-Agent Reasoning System

CI License: MIT TypeScript Next.js PRs Welcome GitHub issues GitHub stars

Modern multi-agent AI reasoning system with TypeScript, Next.js, and extensible architecture

πŸš€ Quick Start β€’ πŸ“– Documentation β€’ 🀝 Contributing β€’ πŸ’¬ Discussions


A modern, extensible multi-agent AI system built with Next.js, TypeScript, and modular architecture. PolarisAI provides a reasoning-based approach to AI interactions, supporting multiple LLM providers and designed for easy extension with new agents.

🎯 Demo

πŸ’¬ Interactive Chat Interface

User: "How does the reasoning system work?"

πŸ€– PolarisAI: Analyzing your question about the reasoning system...

πŸ’­ REASONING PIPELINE:
1. ANALYZE: Understanding your intent about system architecture
2. PLAN: Structuring response about reasoning workflow
3. EXECUTE: Explaining the four-phase pipeline
4. REFLECT: Ensuring comprehensive coverage

✨ RESPONSE:
The reasoning system follows a structured pipeline:
- Analyze β†’ Plan β†’ Execute β†’ Reflect
- Each agent processes input through these phases
- Confidence scoring and reasoning explanations included
- Memory system maintains context across conversations

Confidence: 92%

Try it yourself:

  1. bun dev β†’ Open http://localhost:3000
  2. Configure OpenAI API key in settings
  3. Start chatting with the reasoning system!

πŸ“Š Project Status

πŸ—οΈ Architecture 🧠 AI Models πŸ”§ Development πŸš€ Deployment
βœ… Multi-Agent System βœ… OpenAI GPT-4 βœ… TypeScript βœ… Self-Hosted
βœ… Reasoning Pipeline βœ… Ollama Local βœ… Next.js 15 βœ… Docker Ready
βœ… Memory System πŸ”„ Anthropic Claude βœ… Comprehensive Tests πŸ”„ Cloud Deploy
βœ… Tool Integration πŸ”„ Google Gemini βœ… CI/CD Pipeline πŸ”„ Scaling

Legend: βœ… Available β€’ πŸ”„ In Progress β€’ πŸ“‹ Planned

🎯 Key Highlights

πŸ† Why Choose PolarisAI?

Feature Description Status
🧠 Reasoning-First Every response includes confidence scores and reasoning explanations βœ…
πŸ”— Multi-Provider Works with OpenAI, Ollama, and extensible to any LLM provider βœ…
πŸ—οΈ Extensible Clean architecture for adding new agents and capabilities βœ…
πŸ”’ Privacy-Focused Self-hosted by default, your data stays with you βœ…
πŸ“š Well-Documented Comprehensive guides for users and contributors βœ…
πŸ§ͺ Production-Ready TypeScript, tests, CI/CD, and professional development workflow βœ…

🌟 Features

Core Architecture

  • Multi-Agent System: Extensible framework for specialized AI agents
  • Reasoning Pipeline: Analyze β†’ Plan β†’ Execute β†’ Reflect workflow
  • Provider Agnostic: Support for OpenAI, Ollama, and extensible to other providers
  • Local & Remote Models: Run with local models (Ollama) or cloud APIs (OpenAI, Anthropic)
  • Memory System: Persistent conversation memory and learning capabilities
  • Tool Integration: Extensible tool system for agent capabilities

Current Agents

  • General Assistant: Versatile helper for various tasks and questions
  • Specialized Tools: Text analysis, brainstorming, step-by-step planning
  • Reasoning Display: Shows confidence levels and thought processes

Technical Features

  • TypeScript: Fully typed for better development experience
  • Next.js 15: Modern React framework with App Router
  • Tailwind CSS: Utility-first styling
  • Modular Design: Clean separation of concerns
  • GDPR Compliance: Built-in privacy features and data protection

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ or Bun (recommended)
  • Optional: Ollama for local models

Installation

  1. Clone the repository

    git clone git@github.com:jakubkunert/PolarisAI.git
    cd polaris-ai
  2. Install dependencies

    bun install
    # or
    npm install
  3. Start the development server

    bun dev
    # or
    npm run dev
  4. Open in browser Navigate to http://localhost:3000

Configuration

Using OpenAI

  1. Get an API key from OpenAI
  2. In the web interface, click "Settings"
  3. Select "OpenAI" as provider
  4. Enter your API key
  5. Start chatting!

Using Ollama (Local Models)

  1. Install Ollama: https://ollama.ai
  2. Pull a model: ollama pull llama3.2
  3. Start Ollama service: ollama serve
  4. The system will auto-detect Ollama and use it

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Frontend (Next.js)           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              API Layer                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚          Agent Orchestrator             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚    Agent 1    β”‚    Agent 2    β”‚  ...    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚           Model Providers               β”‚
β”‚  OpenAI β”‚ Ollama β”‚ Anthropic β”‚ ...      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

1. Model Providers (src/core/models/)

  • BaseModelProvider: Abstract base class for all providers
  • OpenAIProvider: OpenAI GPT integration
  • OllamaProvider: Local model support
  • ModelManager: Handles provider registration and routing

2. Agent System (src/core/agents/)

  • BaseAgent: Abstract base class for all agents
  • BasicTaskPlanner: Implements the reasoning pipeline
  • GeneralAssistantAgent: General-purpose assistant
  • Tool System: Extensible capabilities framework

3. Type System (src/core/types/)

  • Comprehensive TypeScript interfaces
  • GDPR-compliant data structures
  • Agent and model abstractions

Reasoning Pipeline

Each agent follows a structured reasoning process:

  1. Analysis: Understand user intent and context
  2. Planning: Create step-by-step action plan
  3. Execution: Carry out the plan with tools
  4. Reflection: Learn from the interaction

πŸ”§ API Reference

Chat Endpoint

POST /api/chat

// Request
{
  "message": "string",
  "provider": "openai" | "ollama" | string,
  "apiKey": "string" // Optional, for remote providers
}

// Response
{
  "success": boolean,
  "response": {
    "id": "string",
    "content": "string",
    "confidence": number, // 0-1
    "reasoning": "string",
    "timestamp": "string",
    "metadata": object
  },
  "agent": {
    "id": "string",
    "name": "string",
    "status": object
  }
}

GET /api/chat

Returns system status and available providers.

πŸ”¨ Development

Project Structure

polaris-ai/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js app router
β”‚   β”‚   β”œβ”€β”€ api/chat/          # API endpoints
β”‚   β”‚   └── page.tsx           # Main interface
β”‚   β”œβ”€β”€ core/                  # Core system
β”‚   β”‚   β”œβ”€β”€ agents/            # Agent implementations
β”‚   β”‚   β”œβ”€β”€ models/            # Model providers
β”‚   β”‚   └── types/             # TypeScript definitions
β”‚   β”œβ”€β”€ components/            # UI components
β”‚   β”œβ”€β”€ lib/                   # Utilities
β”‚   └── hosted/                # Premium features
β”œβ”€β”€ docs/                      # Documentation
└── README.md

Adding New Agents

  1. Create agent class

    // src/core/agents/my-agent.ts
    import { BaseAgent } from './base-agent';
    
    export class MyAgent extends BaseAgent {
      constructor(modelProvider: ModelProvider, modelConfig: ModelConfig) {
        super(
          'my-agent',
          'My Agent',
          'Description of what this agent does',
          ['capability1', 'capability2'],
          'System prompt for the agent...',
          modelProvider,
          modelConfig
        );
      }
    
      createMemory(): LongTermMemory {
        // Implement memory structure
      }
    
      createPlanner(): TaskPlanner {
        // Implement or use existing planner
      }
    }
  2. Register with orchestrator

    // In your orchestrator
    const agent = new MyAgent(modelProvider, modelConfig);
    orchestrator.registerAgent(agent);

Adding New Model Providers

  1. Implement provider

    // src/core/models/my-provider.ts
    import { BaseModelProvider } from './base-provider';
    
    export class MyProvider extends BaseModelProvider {
      constructor() {
        super('my-provider', 'My Provider', 'remote');
      }
    
      async authenticate(apiKey?: string): Promise<boolean> {
        // Implement authentication
      }
    
      async generateResponse(prompt: string, config: ModelConfig): Promise<string> {
        // Implement response generation
      }
    
      // ... other required methods
    }
  2. Register with model manager

    // In model manager
    modelManager.registerProvider(new MyProvider());

πŸ›‘οΈ Privacy & Security

Privacy First

  • Local Processing: Run everything on your own infrastructure
  • Data Control: You own and control all your data
  • No Tracking: No telemetry or data collection
  • Open Source: Full transparency in all operations

Security Features

  • Self-Hosted: Complete control over your environment
  • API Key Security: Secure storage of model provider credentials
  • Audit Trail: Full visibility into all operations
  • Customizable: Modify security to your requirements

🀝 Contributing

We welcome contributions to PolarisAI! Please read our Contributing Guide for details on:

  • Development setup and workflow
  • Git flow and commit conventions
  • Code standards and testing
  • Pull request process
  • Adding new features and agents

Quick Start for Contributors

  1. Fork the repository
  2. Set up your development environment (see CONTRIBUTING.md)
  3. Create a feature branch: git checkout -b feature/your-feature
  4. Make your changes and add tests
  5. Submit a pull request

Development

  • Language: TypeScript
  • Framework: Next.js 15
  • Styling: Tailwind CSS
  • Runtime: Bun (recommended) or Node.js 18+
  • Database: Optional (PostgreSQL for persistence)

For detailed development instructions, see CONTRIBUTING.md.

πŸ“‹ Roadmap

Current Version (v0.1.0)

  • βœ… Multi-agent reasoning system
  • βœ… OpenAI and Ollama provider support
  • βœ… Web interface with chat functionality
  • βœ… Development workflow and contribution guidelines

Upcoming Features

  • Enhanced Agent Capabilities

    • Specialized agents for different domains
    • Advanced reasoning and planning
    • Multi-agent collaboration
  • Extended Model Support

    • Anthropic Claude integration
    • Google Gemini support
    • Custom model providers
  • User Experience

    • Voice interaction support
    • Mobile-responsive design
    • Advanced conversation management
  • Enterprise Features

    • User authentication and management
    • Team collaboration tools
    • Advanced analytics and monitoring

πŸ› Issues and Support

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Thanks to all contributors who help improve PolarisAI
  • Inspired by the open-source AI community
  • Built with amazing tools and frameworks from the JavaScript ecosystem

Ready to build the future of AI agents? Check out our Contributing Guide and join the community! πŸš€

About

Modern multi-agent AI reasoning system with TypeScript, Next.js, and extensible architecture. Supports OpenAI, Ollama, and custom model providers.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •