Skip to main content

Enterprise AI SDK โ€” permission-enforced knowledge retrieval across Jira, Slack, Google Docs

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-1.1.0.tar.gz (189.8 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-1.1.0-py3-none-any.whl (232.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for neurostack_org-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f97fbc6a0bf528bd9e4376a658625afd872572fcb386f8b581c3bf67415eaed8
MD5 87e94bc44966c970f722b829201a4c81
BLAKE2b-256 1e8308622049346c6f2ff5d7bc28813e9693b319ed210afa987cee3b5e93686d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neurostack_org-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 232.4 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-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 247eaa4718e9c7a6a97645f55dc05ac875115162919eebbfa5ce522284f7bc23
MD5 dcb4a73d1e1d98dceae8d6895d785417
BLAKE2b-256 9b352d1190ca2703e5c5b211102b39a499e89aa19c3e563e7824931509a190ac

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