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:
- InputValidator - Validates and normalizes requests
- IntentClassifier - Classifies user intent (9 types)
- KnowledgeRetriever - Retrieves from RAG + live context
- ReasoningEngine - Generates answers with LLM
- ResponseFormatter - Formats final output
- 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
- ARCHITECTURE.md - System design & components
- API_REFERENCE.md - Component APIs
- USAGE_GUIDE.md - How to use the brain
- EVALUATION.md - Quality metrics & calibration
๐ง 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
- LLM Client - Claude API (or compatible)
- Vector Store - Pinecone, Weaviate, Qdrant, etc.
- 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
- Intelligence over automation - Understanding before action
- Reasoning over retrieval - Explaining vs fetching
- Trust over cleverness - Predictable, cautious answers
- Abstraction over tools - Works regardless of backend systems
- 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:
- Anthropic Claude - LLM reasoning
- Pydantic - Data validation
- pytest - Testing framework
Neurostack - Making enterprise knowledge intelligently accessible. f\x00i\x00x\x00 \x00 \x00
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neurostack_org-2.2.3.tar.gz.
File metadata
- Download URL: neurostack_org-2.2.3.tar.gz
- Upload date:
- Size: 217.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
812f06e1189b0045cd8d20dad47c7189bcc8bb8b8302a0e3f91557f61314c80e
|
|
| MD5 |
86d7eb2660b97e36dd5d1528758ce59f
|
|
| BLAKE2b-256 |
477a7a9336e1b3fba1d59e699a515cf4bb65d0187752f39a910a0e7713d3bce5
|
File details
Details for the file neurostack_org-2.2.3-py3-none-any.whl.
File metadata
- Download URL: neurostack_org-2.2.3-py3-none-any.whl
- Upload date:
- Size: 262.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
125172b762fe1c0d3ee0a9e36f1b0b98b8b4dd5efbc41c418a11145cb0775f74
|
|
| MD5 |
9ec3df12fd0b92321da54c93507e9a19
|
|
| BLAKE2b-256 |
c173182a1264c7c96f46afb0bff3bfacf848b1f39300d4f98aa0de9494eb7bed
|