Observed since 21 Oct, 10:16 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
ai-context-manager
Enterprise-grade context management system for AI agents with vector database support
A modular context management system for AI-powered applications with intelligent summarization and feedback learning.
Basic Installation:
pip install -e .
With ChromaDB Support (Development):
pip install -e .[vector]
With PostgreSQL Support (Production):
pip install -e .[production]
Full Installation (All Features):
pip install -e .[all]
Copy env.example to .env and configure:
cp env.example .env
Edit .env with your settings:
# Required for OpenAI summarizer
OPENAI_API_KEY=your_openai_api_key_here
# Optional Ollama configuration
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=mistral
Edit config.toml based on your setup:
For production agents (PostgreSQL + pgvector):
[summarizer]
type = "auto_fallback" # Tries Ollama, falls back to naive
model = "mistral"
[feedback_store]
type = "sqlite"
db_path = "feedback.db"
[memory_store]
type = "postgres_vector" # Enterprise-grade vector database
host = "localhost"
port = 5432
database = "ai_context"
user = "postgres"
password = "your_password"
table_name = "agent_memory"
embedding_dimension = 384
index_type = "hnsw"
For development agents (ChromaDB):
[summarizer]
type = "auto_fallback" # Tries Ollama, falls back to naive
model = "mistral"
[feedback_store]
type = "json"
filepath = "feedback.json"
[memory_store]
type = "vector" # ChromaDB semantic similarity search
collection_name = "agent_memory"
persist_directory = "./chroma_db"
embedding_model = "all-MiniLM-L6-v2"
For automatic fallback (simpler setup):
[summarizer]
type = "auto_fallback" # Tries Ollama, falls back to naive
model = "mistral"
[feedback_store]
type = "json"
filepath = "feedback.json"
[memory_store]
type = "json"
filepath = "memory.json"
For local development (no external dependencies):
[summarizer]
type = "naive" # Simple truncation, works anywhere
[feedback_store]
type = "json"
filepath = "feedback.json"
[memory_store]
type = "json"
filepath = "memory.json"
When on your local network with Ollama:
[summarizer]
type = "ollama"
model = "mistral"
# host will be read from OLLAMA_HOST environment variable
[feedback_store]
type = "json"
filepath = "feedback.json"
[memory_store]
type = "json"
filepath = "memory.json"
For OpenAI integration:
[summarizer]
type = "openai"
model = "gpt-3.5-turbo"
# api_key will be read from OPENAI_API_KEY environment variable
[feedback_store]
type = "json"
filepath = "feedback.json"
[memory_store]
type = "json"
filepath = "memory.json"
from ai_context_manager import ContextManager, TaskSummaryComponent
from ai_context_manager.config import Config
from ai_context_manager.utils import load_stores_from_config, load_summarizer
# Load configuration
config = Config("config.toml")
feedback_store, memory_store = load_stores_from_config(config.data)
# Initialize context manager
ctx = ContextManager(
feedback_store=feedback_store,
memory_store=memory_store,
summarizer=load_summarizer(config)
)
# Add a component
task = TaskSummaryComponent(
id="task-001",
task_name="Example Task",
summary="This is an example task summary",
tags=["example", "demo"]
)
ctx.register_component(task)
# Get context
context = ctx.get_context(
include_tags=["example"],
token_budget=500,
summarize_if_needed=True
)
print(context)
Automatic Fallback (Recommended):
type = "auto_fallback" in config.tomlOLLAMA_HOST=http://192.168.0.156:11434 in .env for your networkOffline/Local Development:
type = "naive" in config.tomlOn Your Local Network:
type = "ollama" in config.tomlOLLAMA_HOST=http://192.168.0.156:11434 in .envInternet Access:
type = "openai" in config.tomlOPENAI_API_KEY=your_key in .envpython test_runner.py
The AI Context Manager includes a command-line interface for easy management:
# Initialize a new project
ai-context init
# Show system status
ai-context status
# Search for content
ai-context search "AI trends"
# Get context for a query
ai-context context "research findings"
# Add content
ai-context add task --id t1 --name "Research" --content "Found insights"
ai-context add learning --id l1 --content "Vector DBs are faster" --source "testing"
# Manage configuration
ai-context config show
ai-context config optimize --use-case agent
Run performance benchmarks to test your system:
python benchmark_performance.py
Try the quick start examples:
python examples/quick_start.py
ai_context_manager/
├── components/ # Context component types
├── store/ # Storage backends
├── summarizers/ # Summarization engines
├── config.py # Configuration management
├── context_manager.py # Main context manager
├── feedback.py # Feedback learning system
└── utils.py # Utility functions
Development (ChromaDB):
Production (PostgreSQL + pgvector):
Performance:
Installation:
# Development
pip install ai-context-manager[vector]
# Production
pip install ai-context-manager[production]
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
openaiEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | openai | runtime |
requestsEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | requests | runtime |
jinja2Environment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | jinja2 | runtime |
tiktokenEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | tiktoken | runtime |
tomlEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | toml | runtime |
urllib3Environment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | urllib3!=2.3.0,>=2.4.0 | runtime |
chromadbEnvironment{
"extras": "",
"marker": "extra == \"vector\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | chromadb>=0.4.0; extra == "vector" | runtime |
sentence-transformersEnvironment{
"extras": "",
"marker": "python_version >= \"3.10\" and extra == \"vector\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | sentence-transformers>=2.2.0; python_version >= "3.10" and extra == "vector" | runtime |
psycopg2-binaryEnvironment{
"extras": "",
"marker": "extra == \"postgres\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | psycopg2-binary>=2.9.0; extra == "postgres" | runtime |
numpyEnvironment{
"extras": "",
"marker": "extra == \"postgres\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | numpy>=1.21.0; extra == "postgres" | runtime |
psycopg2-binaryEnvironment{
"extras": "",
"marker": "extra == \"production\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | psycopg2-binary>=2.9.0; extra == "production" | runtime |
numpyEnvironment{
"extras": "",
"marker": "extra == \"production\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | numpy>=1.21.0; extra == "production" | runtime |
sentence-transformersEnvironment{
"extras": "",
"marker": "python_version >= \"3.10\" and extra == \"production\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | sentence-transformers>=2.2.0; python_version >= "3.10" and extra == "production" | runtime |
clickEnvironment{
"extras": "",
"marker": "extra == \"cli\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | click>=8.0.0; extra == "cli" | runtime |
richEnvironment{
"extras": "",
"marker": "extra == \"cli\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | rich>=10.0.0; extra == "cli" | runtime |
psutilEnvironment{
"extras": "",
"marker": "extra == \"performance\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | psutil>=5.8.0; extra == "performance" | runtime |
memory-profilerEnvironment{
"extras": "",
"marker": "extra == \"performance\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | memory-profiler>=0.60.0; extra == "performance" | runtime |
chromadbEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | chromadb>=0.4.0; extra == "all" | runtime |
sentence-transformersEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | sentence-transformers>=2.2.0; extra == "all" | runtime |
psycopg2-binaryEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | psycopg2-binary>=2.9.0; extra == "all" | runtime |
numpyEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | numpy>=1.21.0; extra == "all" | runtime |
clickEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | click>=8.0.0; extra == "all" | runtime |
richEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | rich>=10.0.0; extra == "all" | runtime |
psutilEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | psutil>=5.8.0; extra == "all" | runtime |
bdist_wheel · 50.67 KB · Python py3
sdist · 43.39 KB · Python source
Shared repository data · GitHub
Observed since 21 Oct, 10:16 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:b71622c9304ee095ebf8e5f843d8d9d876e2fa461af56cd3af96006e667ce5e5