BSS Agent – A simple AI agent framework based on LangGraph
Project description
BSS Agent
A comprehensive AI agent framework built with LangChain and LangGraph for business support systems.
Features
- Authentication: Support client access via API Key.
- Server API:
- FastAPI-based REST API
- Support agent response streaming
- Security:
- Rate limiter to avoid DDOS
- Data Privacy protector
- Prompt santinizer.
- Environment Management: Configuration and environment handling
- Database Integration:
- For checkpoints
- For long memory context (store)
- Multi DB connection
- RAGPipeline:
- Extract data from multi sources
- Automatic create embedding model based on name
- Easy to use Vector DB
- Core Framework: Base agent and multi user sessions management
- Testing: Comprehensive unit test for all features
Installation
From PyPI
pip install bssagent
From Source
git clone https://github.com/bssagent/bssagent.git
cd bssagent
pip install -e .
Development Installation
git clone https://github.com/bssagent/bssagent.git
cd bssagent
pip install -e ".[dev]"
Quick Start
from bssagent.core import BSSAgent
from bssagent.environment import EnvironmentManager
# Initialize environment
env_manager = EnvironmentManager()
env_manager.load_config()
# Create agent
agent = BSSAgent(
name="business_agent",
description="Business support agent",
tools=["file_io", "api_integration", "database"]
)
# Run agent
response = agent.run("Analyze the current business metrics")
print(response)
Project Structure
bssagent/
├── src/bssagent/
│ ├── core/ # Core agent framework
│ ├── infrastructure/ # Infrastructure management
│ ├── auth/ # Authentication
│ ├── security/ # Security features
│ ├── environment/ # Environment management
│ ├── mcp/ # Model Context Protocol
│ ├── rag/ # Tool ecosystem
│ ├── database/ # Database integration
│ └── shared/ # Shared utilities
├── tests/ # Test suite
├── docs/ # Documentation
Configuration
Setup Environment Variables
Create a .env file in your project root with the following configuration:
# LLM API Keys (choose your preferred provider)
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GOOGLE_API_KEY=your_google_api_key
DEEPSEEK_API_KEY=your_deepseek_api_key
OLLAMA_BASE_URL=http://localhost:11434
# LangSmith Tracing (optional)
LANGCHAIN_API_KEY=your_langsmith_api_key
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=your_project_name
# Database Configuration
# Option 1: Use separate databases for checkpointer and store
LANGGRAPH_CHECKPOINTER_TYPE=postgres
LANGGRAPH_CHECKPOINTER_USERNAME=user
LANGGRAPH_CHECKPOINTER_PASSWORD=password
LANGGRAPH_CHECKPOINTER_HOST=localhost
LANGGRAPH_CHECKPOINTER_PORT=5432
LANGGRAPH_CHECKPOINTER_DATABASE=bssagent_checkpoint
LANGGRAPH_STORE_TYPE=postgres
LANGGRAPH_STORE_USERNAME=user
LANGGRAPH_STORE_PASSWORD=password
LANGGRAPH_STORE_HOST=localhost
LANGGRAPH_STORE_PORT=5432
LANGGRAPH_STORE_DATABASE=bssagent_store
# Option 2: Use single database for all purposes
ONE_DB=1
DB_TYPE=postgres
DB_USERNAME=user
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=bssagent
Setup Database with Docker
BSS Agent supports multiple database backends. The easiest way to get started is using Docker Compose.
Quick Database Setup
Use the provided Docker Compose file:
# Navigate to the examples directory
cd examples/dockerdbfile
# Start the databases
docker compose up -d
# Verify containers are running
docker ps
This will start:
- PostgreSQL on port 5432
- MySQL on port 3306
- Redis on port 6379
Manual Docker Setup
If you prefer to set up databases manually, create a docker-compose.yml file:
services:
postgres_db:
image: postgres:14.18-bookworm
container_name: postgres_container
restart: always
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: mydatabase
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
mysql_db:
image: mysql:oracle
container_name: mysql_container
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: mydatabase
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
redis_db:
image: redis:bookworm
container_name: redis_container
restart: always
ports:
- "6379:6379"
volumes:
- redis_data:/data
volumes:
postgres_data:
mysql_data:
redis_data:
Then run:
docker compose up -d
Database Connection Verification
Test your database connections:
PostgreSQL:
# From host machine
psql -h localhost -U user -d mydatabase
# From Docker container
docker exec -it postgres_container psql -U user -d mydatabase
MySQL:
# From host machine
mysql -h localhost -u user -p mydatabase
# From Docker container
docker exec -it mysql_container mysql -u user -p mydatabase
Redis:
# From host machine
redis-cli -h localhost -p 6379
# From Docker container
docker exec -it redis_container redis-cli
Supported Database Types
BSS Agent supports the following database backends:
| Database | Type | Use Case |
|---|---|---|
| PostgreSQL | postgres |
Checkpointer and Store |
| MySQL | mysql |
Checkpointer and Store |
| MongoDB | mongodb |
Checkpointer only |
| Redis | redis |
Checkpointer and Store |
| SQLite | sqlite |
Checkpointer and Store |
Documentation
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Documentation: https://bssagent.readthedocs.io
- Issues: https://github.com/bssagent/bssagent/issues
- Discussions: https://github.com/bssagent/bssagent/discussions
- Email: team@bssagent.com
Changelog
See CHANGELOG.md for a list of changes and version history.
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 Distributions
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 bssagent-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bssagent-0.1.1-py3-none-any.whl
- Upload date:
- Size: 66.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f1df122dfe484716f0fa16c1742e9ec486a6f8735451e2d7c1f61505b0c25fa
|
|
| MD5 |
098932e69f8c2764d74a510418d2453d
|
|
| BLAKE2b-256 |
bfbfc226685e7b5cdab1d9ec8f7360b81456b3ab2c7f36a068e67092c0543970
|