A Production-Ready Framework for LLM Applications, Autonomous Agents, and RAG Systems
Features β’ Quickstart β’ Installation β’ Architecture β’ Documentation
LLMCore is a comprehensive Python library providing a unified, asynchronous interface for building production-grade LLM applications. From simple chat interactions to sophisticated autonomous agents with sandboxed code execution, LLMCore offers a complete toolkit for modern AI development.
| Category | Features |
|---|---|
| π Multi-Provider Support | OpenAI, Anthropic, Google Gemini, Ollama, DeepSeek, Mistral, Qwen, xAI |
| π¬ Chat Interface | Unified chat() API, streaming responses, tool/function calling |
| π¦ Session Management | Persistent conversations, SQLite/PostgreSQL backends, transient sessions |
| π RAG System | ChromaDB/pgvector storage, semantic search, context injection |
| π€ Autonomous Agents | 8-phase cognitive cycle, goal classification, iterative reasoning |
| π Sandboxed Execution | Docker/VM isolation, security policies, output tracking |
| π€ Human-in-the-Loop | Risk assessment, approval workflows, audit logging |
| π Observability | Structured event logging, metrics collection, execution replay |
| π Persona System | Customizable agent personalities and communication styles |
| π Model Card Library | Comprehensive model metadata, capability validation, cost estimation |
- π³ Sandbox System: Complete Docker and VM-based isolation for agent code execution
- π§ Darwin Layer 2: Enhanced cognitive cycle with 8 reasoning phases
- β‘ Fast-Path Execution: Sub-5-second responses for trivial goals
- π Circuit Breaker: Automatic detection and interruption of failing agent loops
- π Activity System: XML-based structured output for models without native tool support
- π Comprehensive Observability: JSONL event logging with execution replay
import asyncio
from llmcore import LLMCore
async def main():
async with await LLMCore.create() as llm:
# Simple question
response = await llm.chat("What is the capital of France?")
print(response)
# Streaming response
stream = await llm.chat("Tell me a story.", stream=True)
async for chunk in stream:
print(chunk, end="", flush=True)
asyncio.run(main())async def conversation():
async with await LLMCore.create() as llm:
# First message - sets context
await llm.chat(
"My name is Alex and I love astronomy.",
session_id="alex_chat",
system_message="You are a friendly science tutor."
)
# Follow-up - LLM remembers context
response = await llm.chat(
"What should I observe tonight?",
session_id="alex_chat"
)
print(response)async def rag_example():
async with await LLMCore.create() as llm:
# Add documents to vector store
await llm.add_documents_to_vector_store(
documents=[
{"content": "LLMCore supports multiple providers...", "metadata": {"source": "docs"}},
{"content": "Configuration uses the confy library...", "metadata": {"source": "docs"}},
],
collection_name="my_docs"
)
# Query with RAG
response = await llm.chat(
"How does LLMCore handle configuration?",
enable_rag=True,
rag_collection_name="my_docs",
rag_retrieval_k=3
)
print(response)from llmcore.agents import AgentManager, AgentMode
async def agent_example():
async with await LLMCore.create() as llm:
# Create agent manager
agent = AgentManager(
provider_manager=llm._provider_manager,
memory_manager=llm._memory_manager,
storage_manager=llm._storage_manager
)
# Run agent with a goal
result = await agent.run(
goal="Research the top 3 Python web frameworks and compare them",
mode=AgentMode.SINGLE
)
print(result.final_answer)Requires Python 3.11 or later.
pip install llmcore# OpenAI support
pip install llmcore[openai]
# Anthropic Claude support
pip install llmcore[anthropic]
# Google Gemini support
pip install llmcore[gemini]
# Local Ollama support
pip install llmcore[ollama]# ChromaDB for vector storage
pip install llmcore[chromadb]
# PostgreSQL with pgvector
pip install llmcore[postgres]# Docker sandbox
pip install llmcore[sandbox-docker]
# VM/SSH sandbox
pip install llmcore[sandbox-vm]
# Both sandbox types
pip install llmcore[sandbox]# Everything included
pip install llmcore[all]git clone https://github.com/araray/llmcore.git
cd llmcore
pip install -e ".[dev]"βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LLMCore API Facade β
β (llmcore.api.LLMCore) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Provider β β Session β β Memory β β Embedding β β
β β Manager β β Manager β β Manager β β Manager β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β β
β ββββββββ΄ββββββββ ββββββββ΄ββββββββ ββββββββ΄ββββββββ ββββββββ΄ββββββββ β
β β Providers β β Storage β β RAG β β Embeddings β β
β β β’ OpenAI β β β’ SQLite β β β’ ChromaDB β β β’ Sentence β β
β β β’ Anthropic β β β’ Postgres β β β’ pgvector β β Transform β β
β β β’ Gemini β β β’ JSON β β β β β’ OpenAI β β
β β β’ Ollama β β β β β β β’ Google β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Agent System (Darwin Layer 2) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Cognitive Cycle β β
β β PERCEIVE β PLAN β THINK β VALIDATE β ACT β OBSERVE β REFLECT β UPDATEβ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Goal β β Fast-Path β β Circuit β β HITL β β
β β Classifier β β Executor β β Breaker β β Manager β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Persona β β Prompt β β Activity β β Capability β β
β β Manager β β Library β β System β β Checker β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Sandbox System β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Docker Provider β VM Provider β Registry β Output Tracker β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Supporting Systems β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Model Card β βObservabilityβ β Tracing β β Logging β β
β β Registry β β System β β System β β Config β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
LLMCore uses confy for layered configuration with the following precedence (highest priority last):
- Package Defaults β
llmcore/config/default_config.toml - User Config β
~/.config/llmcore/config.toml - Custom File β
LLMCore.create(config_file_path="...") - Environment Variables β
LLMCORE_*prefix - Direct Overrides β
LLMCore.create(config_overrides={...})
# ~/.config/llmcore/config.toml
[llmcore]
default_provider = "openai"
default_embedding_model = "text-embedding-3-small"
log_level = "INFO"
[providers.openai]
# API key via: LLMCORE_PROVIDERS__OPENAI__API_KEY or OPENAI_API_KEY
default_model = "gpt-4o"
timeout = 60
[providers.anthropic]
default_model = "claude-sonnet-4-5-20250929"
timeout = 60
[providers.ollama]
# host = "http://localhost:11434"
default_model = "llama3.2:latest"
[storage.session]
type = "sqlite"
path = "~/.llmcore/sessions.db"
[storage.vector]
type = "chromadb"
path = "~/.llmcore/chroma_db"
default_collection = "llmcore_default"
[agents]
max_iterations = 10
default_timeout = 600
[agents.sandbox]
mode = "docker"
[agents.sandbox.docker]
enabled = true
image = "python:3.11-slim"
memory_limit = "1g"
cpu_limit = 2.0
network_enabled = false
[agents.hitl]
enabled = true
global_risk_threshold = "medium"
default_timeout_seconds = 300# Provider API Keys
export LLMCORE_PROVIDERS__OPENAI__API_KEY="sk-..."
export LLMCORE_PROVIDERS__ANTHROPIC__API_KEY="sk-ant-..."
export LLMCORE_PROVIDERS__GEMINI__API_KEY="..."
# Or use standard provider env vars
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
# Storage
export LLMCORE_STORAGE__SESSION__TYPE="postgres"
export LLMCORE_STORAGE__SESSION__DB_URL="postgresql://user:pass@localhost/llmcore"
# Logging
export LLMCORE_LOG_LEVEL="DEBUG"
export LLMCORE_LOG_RAW_PAYLOADS="true"LLMCore supports multiple LLM providers through a unified interface:
| Provider | Models | Features |
|---|---|---|
| OpenAI | GPT-4o, GPT-4o-mini, GPT-5.2, o1, o3-mini | Streaming, Tools, Vision |
| Anthropic | Claude Opus 4.5, Sonnet 4.5, Haiku 4.5 | Streaming, Tools, Vision |
| Gemini 2.5 Pro/Flash, Gemini 3 Preview | Streaming, Tools, Vision | |
| Ollama | Llama 3.2/3.3, Gemma 3, Phi-3, Mistral | Streaming, Local |
| DeepSeek | DeepSeek-R1, DeepSeek-V3.2, DeepSeek-Chat | Streaming, Reasoning |
| Mistral | Mistral Large 3 | Streaming, Tools |
| Qwen | Qwen 3 Max, Qwen3-Coder-480B | Streaming, Tools |
| xAI | Grok-4, Grok-4-Heavy | Streaming, Tools |
# Use default provider
response = await llm.chat("Hello!")
# Override per-request
response = await llm.chat(
"Explain quantum computing",
provider_name="anthropic",
model_name="claude-sonnet-4-5-20250929"
)
# With provider-specific parameters
response = await llm.chat(
"Write a poem",
provider_name="openai",
model_name="gpt-4o",
temperature=0.9,
max_tokens=500
)The agent system implements an advanced cognitive architecture for autonomous task execution.
The 8-phase cognitive cycle enables sophisticated reasoning:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COGNITIVE CYCLE β
β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β PERCEIVE β β β PLAN β β β THINK β β β VALIDATE β β
β β β β β β β β β β
β β Analyze β β Generate β β Reason & β β Check β β
β β goal & β β strategy β β decide β β validity β β
β β context β β β β action β β β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β β β
β β β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β UPDATE β β β REFLECT β β β OBSERVE β β β ACT β β
β β β β β β β β β β
β β Update β β Learn & β β Analyze β β Execute β β
β β state & β β improve β β results β β action β β
β β memory β β β β β β β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Phase Descriptions:
| Phase | Purpose |
|---|---|
| PERCEIVE | Analyze goal, extract entities, assess complexity |
| PLAN | Generate execution strategy and select approach |
| THINK | Reason about next action using CoT/ReAct patterns |
| VALIDATE | Check proposed action validity and safety |
| ACT | Execute the chosen action (tool call, code, etc.) |
| OBSERVE | Analyze results and extract observations |
| REFLECT | Learn from outcome, identify improvements |
| UPDATE | Update working memory and iteration state |
Automatic goal complexity assessment for optimal routing:
from llmcore.agents import GoalClassifier, classify_goal
# Classify a goal
classification = classify_goal("What's 2 + 2?")
print(classification.complexity) # GoalComplexity.TRIVIAL
print(classification.execution_strategy) # ExecutionStrategy.FAST_PATH
# Complex goal
classification = classify_goal(
"Research and compare the top 5 cloud providers, "
"analyze their pricing, and create a recommendation report"
)
print(classification.complexity) # GoalComplexity.COMPLEX
print(classification.max_iterations) # 15Complexity Levels:
| Level | Max Iterations | Examples |
|---|---|---|
TRIVIAL |
1 | Greetings, simple math, factual Q&A |
SIMPLE |
5 | Single-step tasks, translations |
MODERATE |
10 | Multi-step tasks, analysis |
COMPLEX |
15 | Research, multi-source synthesis |
Bypass the full cognitive cycle for trivial goals (sub-5s responses):
from llmcore.agents.learning import FastPathExecutor, should_use_fast_path
# Check if fast-path is appropriate
if should_use_fast_path("Hello, how are you?"):
executor = FastPathExecutor(config=fast_path_config)
result = await executor.execute(goal="Hello!")
print(result.response) # Instant responseAutomatic detection and interruption of failing agent loops:
from llmcore.agents import AgentCircuitBreaker, CircuitBreakerConfig
breaker = AgentCircuitBreaker(CircuitBreakerConfig(
max_iterations=15,
max_same_errors=3,
max_execution_time_seconds=300,
max_total_cost=1.0,
progress_stall_threshold=5
))
# Circuit breaker trips on:
# - Maximum iterations exceeded
# - Repeated identical errors
# - Timeout exceeded
# - Cost limit exceeded
# - Progress stall detectedInteractive approval workflows for sensitive operations:
from llmcore.agents.hitl import HITLManager, HITLConfig, ConsoleHITLCallback
# Create HITL manager
hitl = HITLManager(
config=HITLConfig(
enabled=True,
global_risk_threshold="medium",
timeout_policy="reject"
),
callback=ConsoleHITLCallback() # Interactive console prompts
)
# Check if activity needs approval
decision = await hitl.check_approval(
activity_type="execute_shell",
parameters={"command": "rm -rf /tmp/test"}
)
if decision.is_approved:
# Execute the activity
pass
else:
print(f"Rejected: {decision.reason}")Risk Levels:
| Level | Requires Approval | Examples |
|---|---|---|
LOW |
No | Read files, calculations |
MEDIUM |
Configurable | Write files, API calls |
HIGH |
Yes | Delete files, network access |
CRITICAL |
Always | System commands, credentials |
Customize agent behavior and communication style:
from llmcore.agents import PersonaManager, AgentPersona, PersonalityTrait
# Create a custom persona
persona = AgentPersona(
name="DataAnalyst",
description="A meticulous data analyst focused on accuracy",
personality=[
PersonalityTrait.ANALYTICAL,
PersonalityTrait.METHODICAL,
PersonalityTrait.CAUTIOUS
],
communication_style="formal",
risk_tolerance="low",
planning_depth="thorough"
)
# Apply to agent
manager = PersonaManager()
manager.register_persona(persona)
agent_state.persona = manager.get_persona("DataAnalyst")Secure, isolated execution environments for agent-generated code.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Sandbox Registry β
β (Manages sandbox lifecycle) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β Docker Provider β β VM Provider β β
β β β β β β
β β β’ Container isolation β β β’ SSH-based access β β
β β β’ Image management β β β’ Full VM isolation β β
β β β’ Resource limits β β β’ Network separation β β
β β β’ Output capture β β β’ Persistent storage β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β Output Tracker β β Ephemeral Manager β β
β β β β β β
β β β’ File lineage β β β’ Resource cleanup β β
β β β’ Execution logs β β β’ Timeout handling β β
β β β’ Artifact collection β β β’ State management β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
from llmcore import (
SandboxRegistry, DockerSandboxProvider, SandboxConfig, SandboxMode
)
# Create sandbox registry
registry = SandboxRegistry()
# Register Docker provider
docker_provider = DockerSandboxProvider(SandboxConfig(
mode=SandboxMode.DOCKER,
image="python:3.11-slim",
memory_limit="1g",
cpu_limit=2.0,
timeout_seconds=300,
network_enabled=False
))
registry.register_provider("docker", docker_provider)
# Create and use sandbox
async with registry.create_sandbox("docker") as sandbox:
# Execute Python code
result = await sandbox.execute_python("""
import math
print(f"Pi = {math.pi}")
""")
print(result.stdout) # "Pi = 3.141592653589793"
# Execute shell command
result = await sandbox.execute_shell("ls -la")
print(result.stdout)
# Save file
await sandbox.save_file("output.txt", "Hello, Sandbox!")
# Read file
content = await sandbox.load_file("output.txt")Pre-built, security-hardened images organized by tier:
| Tier | Image | Description |
|---|---|---|
| Base | llmcore-sandbox-base:1.0.0 |
Minimal Ubuntu 24.04 |
| Specialized | llmcore-sandbox-python:1.0.0 |
Python 3.12 development |
llmcore-sandbox-nodejs:1.0.0 |
Node.js 22 development | |
llmcore-sandbox-shell:1.0.0 |
Shell scripting | |
| Task | llmcore-sandbox-research:1.0.0 |
Research & analysis |
llmcore-sandbox-websearch:1.0.0 |
Web scraping |
| Level | Network | Filesystem | Tools |
|---|---|---|---|
RESTRICTED |
Blocked | Limited | Whitelisted only |
FULL |
Enabled | Extended | All tools |
- Non-root execution: All containers run as
sandboxuser (UID 1000) - No SUID/SGID binaries: Privilege escalation vectors removed
- Resource limits: Memory, CPU, and process limits enforced
- Network isolation: Optional network blocking
- Output tracking: Full lineage and audit trail
- AppArmor/seccomp ready: Compatible with security profiles
Comprehensive metadata management for LLM models.
from llmcore import get_model_card_registry, get_model_card
# Get registry singleton
registry = get_model_card_registry()
# Lookup model card
card = registry.get("openai", "gpt-4o")
print(f"Context: {card.get_context_length():,} tokens")
print(f"Vision: {card.capabilities.vision}")
print(f"Tools: {card.capabilities.tools}")
# Cost estimation
cost = card.estimate_cost(
input_tokens=50_000,
output_tokens=2_000,
cached_tokens=10_000
)
print(f"Estimated cost: ${cost:.4f}")
# List models by capability
vision_models = registry.list_cards(tags=["vision"])
for model in vision_models:
print(f"{model.provider}/{model.model_id}")
# Alias resolution
card = registry.get("anthropic", "claude-4.5-sonnet") # Resolves aliasBuilt-in model cards for:
- OpenAI: GPT-4o, GPT-4o-mini, GPT-5.2, o1, o3-mini, embeddings
- Anthropic: Claude Opus 4.5, Sonnet 4.5, Haiku 4.5
- Google: Gemini 2.5 Pro/Flash, Gemini 3 Preview
- Ollama: Llama 3.2/3.3, Gemma 3, Phi-3, Mistral, CodeLlama
- DeepSeek: DeepSeek-R1, DeepSeek-V3.2
- Mistral: Mistral Large 3
- Qwen: Qwen 3 Max, Qwen3-Coder
- xAI: Grok-4, Grok-4-Heavy
Add custom cards in ~/.config/llmcore/model_cards/<provider>/<model>.json:
{
"model_id": "my-custom-model",
"display_name": "My Custom Model",
"provider": "ollama",
"model_type": "chat",
"context": {
"max_input_tokens": 32768,
"max_output_tokens": 4096
},
"capabilities": {
"streaming": true,
"tools": false,
"vision": false
}
}Comprehensive monitoring and debugging for agent executions.
from llmcore.agents.observability import EventLogger, EventCategory
# Events logged to ~/.llmcore/events.jsonl
logger = EventLogger(log_path="~/.llmcore/events.jsonl")
# Event categories
# - LIFECYCLE: Agent start/stop
# - COGNITIVE: Phase execution
# - ACTIVITY: Tool executions
# - HITL: Human approvals
# - ERROR: Exceptions
# - METRIC: Performance data
# - MEMORY: Memory operations
# - SANDBOX: Container lifecycle
# - RAG: Retrieval operationsfrom llmcore.agents.observability import MetricsCollector
collector = MetricsCollector()
# Available metrics
# - Iteration counts
# - LLM call latency (p50, p90, p95, p99)
# - Token usage (input/output)
# - Estimated costs
# - Activity execution times
# - Error counts by typefrom llmcore.agents.observability import ExecutionReplay
replay = ExecutionReplay(events_path="~/.llmcore/events.jsonl")
# List executions
executions = replay.list_executions()
for exec_id, metadata in executions.items():
print(f"{exec_id}: {metadata['goal']}")
# Replay specific execution
events = replay.get_execution_events(exec_id)
for event in events:
print(f"[{event.timestamp}] {event.category}: {event.type}")[agents.observability]
enabled = true
[agents.observability.events]
enabled = true
log_path = "~/.llmcore/events.jsonl"
min_severity = "info"
categories = [] # Empty = all categories
[agents.observability.events.rotation]
strategy = "size"
max_size_mb = 100
max_files = 10
compress = true
[agents.observability.metrics]
enabled = true
track_cost = true
track_tokens = true
latency_percentiles = [50, 90, 95, 99]
[agents.observability.replay]
enabled = true
cache_enabled = true
cache_max_executions = 50Retrieval-Augmented Generation for knowledge-enhanced responses.
# Add documents with metadata
await llm.add_documents_to_vector_store(
documents=[
{
"content": "LLMCore is a Python library...",
"metadata": {
"source": "documentation",
"version": "0.26.0",
"category": "overview"
}
},
{
"content": "Configuration uses the confy library...",
"metadata": {
"source": "documentation",
"category": "configuration"
}
}
],
collection_name="project_docs"
)# Direct similarity search
results = await llm.search_vector_store(
query="How does configuration work?",
k=5,
collection_name="project_docs",
metadata_filter={"category": "configuration"}
)
for doc in results:
print(f"Score: {doc.score:.4f}")
print(f"Content: {doc.content[:100]}...")
print(f"Metadata: {doc.metadata}")response = await llm.chat(
"Explain how to configure providers",
enable_rag=True,
rag_collection_name="project_docs",
rag_retrieval_k=3,
system_message="Answer based ONLY on the provided context."
)LLMCore can serve as an LLM backend for external RAG engines:
# External engine (e.g., semantiscan) handles retrieval
relevant_docs = await external_rag_engine.retrieve(query)
# Construct prompt with retrieved context
context = format_documents(relevant_docs)
full_prompt = f"Context:\n{context}\n\nQuestion: {query}"
# Use LLMCore for generation only
response = await llm.chat(
message=full_prompt,
enable_rag=False, # Disable internal RAG
explicitly_staged_items=[] # Optional additional context
)| Class | Description |
|---|---|
LLMCore |
Main facade for all LLM operations |
AgentManager |
Manages autonomous agent execution |
StorageManager |
Handles session and vector storage |
ProviderManager |
Manages LLM provider connections |
| Model | Description |
|---|---|
ChatSession |
Conversation session with messages |
Message |
Individual chat message (user/assistant/system) |
ContextDocument |
Document for RAG/context |
Tool |
Function/tool definition |
ToolCall |
Tool invocation by LLM |
ToolResult |
Result of tool execution |
ModelCard |
Model metadata and capabilities |
from llmcore import (
LLMCoreError, # Base exception
ConfigError, # Configuration issues
ProviderError, # LLM provider errors
StorageError, # Storage operations
SessionStorageError, # Session storage specific
VectorStorageError, # Vector storage specific
SessionNotFoundError, # Session lookup failure
ContextError, # Context management
ContextLengthError, # Context exceeds limits
EmbeddingError, # Embedding generation
SandboxError, # Sandbox execution
SandboxInitializationError,
SandboxExecutionError,
SandboxTimeoutError,
SandboxAccessDenied,
SandboxResourceError,
SandboxConnectionError,
SandboxCleanupError,
)llmcore/
βββ src/llmcore/
β βββ __init__.py # Public API exports
β βββ api.py # Main LLMCore class
β βββ models.py # Core data models
β βββ exceptions.py # Exception hierarchy
β βββ config/ # Configuration system
β β βββ default_config.toml
β β βββ models.py
β βββ providers/ # LLM provider implementations
β β βββ openai_provider.py
β β βββ anthropic_provider.py
β β βββ gemini_provider.py
β β βββ ollama_provider.py
β βββ storage/ # Storage backends
β β βββ sqlite_session.py
β β βββ postgres_session_storage.py
β β βββ chromadb_vector.py
β β βββ pgvector_storage.py
β βββ embedding/ # Embedding models
β β βββ sentence_transformer.py
β β βββ openai.py
β β βββ google.py
β βββ agents/ # Agent system
β β βββ manager.py # AgentManager
β β βββ cognitive/ # 8-phase cognitive cycle
β β βββ hitl/ # Human-in-the-loop
β β βββ sandbox/ # Sandbox execution
β β βββ learning/ # Learning mechanisms
β β βββ persona/ # Persona system
β β βββ prompts/ # Prompt library
β β βββ observability/ # Monitoring & logging
β β βββ routing/ # Model routing
β βββ model_cards/ # Model metadata
β β βββ registry.py
β β βββ schema.py
β β βββ default_cards/
β βββ memory/ # Memory management
βββ container_images/ # Sandbox Docker images
βββ examples/ # Usage examples
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ pyproject.toml # Project configuration
# Run all tests
pytest
# Run with coverage
pytest --cov=src/llmcore --cov-report=term-missing
# Run specific test categories
pytest -m "not slow" # Skip slow tests
pytest -m "not integration" # Skip integration tests
pytest -m sandbox # Run sandbox tests only
# Run specific test file
pytest tests/agents/test_cognitive_system.pyContributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
pytest) - Follow the existing code style (
ruff check .) - Commit with conventional commits (
feat: add amazing feature) - Push to your branch
- Open a Pull Request
git clone https://github.com/araray/llmcore.git
cd llmcore
pip install -e ".[dev]"
pre-commit install- Formatter: Ruff
- Type Hints: Required for all public APIs
- Docstrings: Google style
- Line Length: 100 characters
This project is licensed under the MIT License. See the LICENSE file for details.
- llmchat - CLI interface for llmcore
- semantiscan - Advanced RAG engine
- confy - Configuration management library
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ by Araray Velho
