Skip to main content

Enterprise AI SDK โ€” permission-aware organizational knowledge retrieval with 9 connectors, 5-stage deterministic pipeline, and universal ingestion

Project description

Neurostack Brain

Enterprise AI Intelligence Brain

Neurostack is an AI intelligence layer designed to sit on top of a company's existing systems and make them easier to understand, query, and reason about.

๐ŸŽฏ What Is Neurostack?

Neurostack is not a chatbot, project management tool, or workflow automation platform.

Neurostack is an AI Brain that:

  • Reasons over company knowledge (documents, meetings, tasks, decisions)
  • Provides accurate, contextual answers
  • Respects persona-based access control (employee vs manager)
  • Handles uncertainty gracefully
  • Operates at enterprise scale

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Brain Pipeline                       โ”‚
โ”‚                                                          โ”‚
โ”‚  Input โ†’ Validate โ†’ Classify โ†’ Retrieve โ†’ Reason โ†’ Format โ”‚
โ”‚         (Stage 1)  (Stage 2)  (Stage 3)  (Stage 4) (Stage 5) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Properties:
- 2 LLM calls per query (classify + reason)
- Single-pass, deterministic execution
- Batch-friendly, rate-limited safe
- Full audit trail via tracing

Core Components:

  1. InputValidator - Validates and normalizes requests
  2. IntentClassifier - Classifies user intent (9 types)
  3. KnowledgeRetriever - Retrieves from RAG + live context
  4. ReasoningEngine - Generates answers with LLM
  5. ResponseFormatter - Formats final output
  6. BrainOrchestrator - Coordinates full pipeline

See ARCHITECTURE.md for detailed design.

๐Ÿš€ Quick Start

Installation

# Clone repository
git clone https://github.com/your-org/neurostack-brain.git
cd neurostack-brain

# Install dependencies
pip install -r requirements.txt

# Set up environment
export ANTHROPIC_API_KEY="your-api-key"

Basic Usage

from brain.factory import BrainFactory
from clients.anthropic_llm import AnthropicLLMClient
from clients.mock_vector_store import MockVectorStore
from clients.mock_embedding import SimpleEmbeddingClient

# Initialize clients
llm_client = AnthropicLLMClient(api_key="your-key")
vector_store = MockVectorStore()
embedding_client = SimpleEmbeddingClient(dimension=768)

# Create brain
brain = BrainFactory.create_brain(
    llm_client=llm_client,
    vector_store=vector_store,
    embedding_client=embedding_client
)

# Process query
response = brain.process({
    "query": {
        "user_input": "What is our refund policy?"
    },
    "context": {
        "tenant_id": "company_a",
        "persona": "employee",
        "user_id": "alice@company.com"
    },
    "conversation_history": [],
    "live_context": {},
    "options": {}
})

print(f"Answer: {response.answer.content}")
print(f"Confidence: {response.answer.confidence.value}")

See examples/ for more usage patterns.

๐Ÿ“‹ Features

โœ… Knowledge Types

  • Documents (policies, SOPs, manuals)
  • Tasks (work items, tickets)
  • Meetings (decisions, action items)
  • Decisions (finalized outcomes)
  • Metrics (KPIs, analytics)
  • Events (changes, incidents)
  • Facts (distilled truths)

โœ… Intent Classification

  • Informational queries
  • Status queries
  • Metrics queries
  • Summary requests
  • Planning requests
  • Task actions
  • Decision recall
  • Out-of-scope detection

โœ… Persona-Based Access Control

  • Employee: Personal tasks, public docs
  • Manager: Team analytics, multi-person visibility
  • Automatic scope enforcement
  • Graceful refusal with suggestions

โœ… Confidence & Uncertainty

  • 3-level confidence model (retrieval, answer, action)
  • Conflict detection
  • Staleness warnings
  • Source attribution
  • Reasoning transparency

โœ… Memory Architecture

  • Short-term: Conversation context (ephemeral)
  • Long-term: RAG/vector store (persistent)
  • Live context: Current state (injected)

๐Ÿงช Testing

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=brain --cov-report=html tests/

# Run specific category
pytest tests/unit/           # Unit tests
pytest tests/integration/    # Integration tests
pytest tests/evaluation/     # Evaluation tests

Test Coverage:

  • Unit tests: ~15 tests
  • Integration tests: ~12 tests
  • Evaluation tests: ~1 test
  • Total: ~28 comprehensive tests

See tests/README.md for testing guide.

๐Ÿ“š Documentation

๐Ÿ”ง Configuration

from brain.config.brain_config import BrainConfig, LLMSettings
from brain.config.retrieval_config import RetrieverConfig

config = BrainConfig(
    llm=LLMSettings(
        model="claude-sonnet-4-20250514",
        temperature=0.0,
        max_tokens=1500
    ),
    retrieval=RetrieverConfig(
        default_top_k=10,
        strong_threshold=0.80
    )
)

brain = BrainFactory.create_brain(
    llm_client=llm_client,
    vector_store=vector_store,
    embedding_client=embedding_client,
    config=config  # Custom config
)

All thresholds and parameters are configurable via dataclasses or YAML.

๐Ÿข Production Considerations

Required External Services

  1. LLM Client - Claude API (or compatible)
  2. Vector Store - Pinecone, Weaviate, Qdrant, etc.
  3. Embedding Client - OpenAI, Cohere, etc.

Recommended Infrastructure

  • Async Job Queue - For heavy analysis (Celery, RQ)
  • Cache Layer - For embeddings and retrieval (Redis)
  • Trace Storage - For audit trail (PostgreSQL, Elasticsearch)
  • Rate Limiting - External rate limiter (not in brain)

Performance Characteristics

  • Latency: ~2-5 seconds per query (2 LLM calls)
  • Throughput: Rate-limited by LLM provider
  • Memory: ~100-500 MB per brain instance
  • Scalability: Stateless, horizontally scalable

๐Ÿ›ก๏ธ Design Principles

  1. Intelligence over automation - Understanding before action
  2. Reasoning over retrieval - Explaining vs fetching
  3. Trust over cleverness - Predictable, cautious answers
  4. Abstraction over tools - Works regardless of backend systems
  5. Incremental adoption - Provides value with partial data

๐Ÿ“Š Status

Current Phase: Early validation (tested with ~500 users across multiple companies)

Production Readiness:

  • โœ… Core pipeline complete
  • โœ… Comprehensive test suite
  • โœ… Persona enforcement
  • โœ… Error handling
  • โš ๏ธ Async job support (basic implementation)
  • โš ๏ธ Caching layer (deferred)
  • โš ๏ธ Distributed tracing (basic implementation)

๐Ÿค Contributing

Contributions are welcome! Please read our CONTRIBUTING.md first.

Development Setup

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run linting
black src/ tests/
mypy src/
ruff check src/

๐Ÿ“ License

[Your License Here]

๐Ÿ™ Acknowledgments

Built with:


Neurostack - Making enterprise knowledge intelligently accessible. f\x00i\x00x\x00 \x00 \x00

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neurostack_org-2.2.0.tar.gz (214.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neurostack_org-2.2.0-py3-none-any.whl (259.5 kB view details)

Uploaded Python 3

File details

Details for the file neurostack_org-2.2.0.tar.gz.

File metadata

  • Download URL: neurostack_org-2.2.0.tar.gz
  • Upload date:
  • Size: 214.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for neurostack_org-2.2.0.tar.gz
Algorithm Hash digest
SHA256 d0f7a8c5a7df0706e09044176756611d6c5c117ed888f76cac88d9fe9ab5f3cf
MD5 997d9993403ac35fa5fced80f46570f5
BLAKE2b-256 56a1fa51f5bffb440eea3fbd5666f72867664092f3d97325b5522b12ced06449

See more details on using hashes here.

File details

Details for the file neurostack_org-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: neurostack_org-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 259.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for neurostack_org-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae1edb27f3f387e625755d547422cfc36fbdaba35dfe3948141617f356b7a6f
MD5 42984f6fb5659e65ca4a84e5054c2c39
BLAKE2b-256 1bf0bbffb4d5fedc6a9612f244faf8b2defb2ce73755885cecb4de9466aaf365

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page