A comprehensive Python client for the HeySol API with MCP protocol support
Project description
HeySol API Client
A comprehensive Python client for the HeySol API with MCP protocol support, memory management, and CLI tools.
Features
- 🚀 Full API Coverage: Complete HeySol API endpoints
- 🔐 Authentication: API key and Bearer token support
- 📝 Memory Management: Ingest, search, and manage memory spaces
- 🛡️ Error Handling: Robust exception hierarchy with retries
- 📊 Rate Limiting: Built-in throttling and rate limiting
- 🖥️ CLI Interface: Command-line tools for all operations
- 📚 Type Hints: Full type annotation support
- 🧪 Well Tested: Comprehensive test suite
Installation
pip install heysol-api-client
For development:
pip install -e ".[dev]"
Quick Start
- Get your API key from HeySol Core
- Set environment variable:
export HEYSOL_API_KEY="your-api-key-here"
- Try the quick start:
python quick_start.py
Basic Usage
from heysol import HeySolClient
# Initialize client
client = HeySolClient(api_key="your-api-key")
# Create a space
space_id = client.create_space("Research", "Clinical data")
# Ingest data
client.ingest("New treatment shows promise", space_id=space_id)
# Search
results = client.search("treatment", space_ids=[space_id])
print(results["episodes"])
client.close()
CLI Usage
# Profile
heysol-client profile get
# Spaces
heysol-client spaces list
heysol-client spaces create "My Space" --description "Data space"
# Memory operations
heysol-client memory ingest "Clinical data" --space-id <space-id>
heysol-client memory search "cancer research" --limit 10
# Logs
heysol-client logs list --status success
heysol-client logs delete-by-source "source-name" --confirm
Configuration
Set environment variables:
export HEYSOL_API_KEY="your-key"
export HEYSOL_BASE_URL="https://core.heysol.ai/api/v1"
export HEYSOL_SOURCE="my-app"
Or use a config file:
from heysol import HeySolConfig
config = HeySolConfig.from_file("config.json")
client = HeySolClient(config=config)
API Reference
Core Methods
Memory Operations:
ingest(message, space_id=None)- Add data to memorysearch(query, space_ids=None, limit=10)- Search memoriessearch_knowledge_graph(query, space_id=None)- Graph search
Space Operations:
get_spaces()- List all spacescreate_space(name, description="")- Create new spaceupdate_space(space_id, name=None, description=None)- Update spacedelete_space(space_id, confirm=False)- Delete space
Log Operations:
get_ingestion_logs(space_id=None, limit=100)- Get logscheck_ingestion_status(run_id=None)- Check status
Webhook Operations:
register_webhook(url, events=None, secret="")- Create webhooklist_webhooks(space_id=None)- List webhooks
Error Handling
from heysol import HeySolError, AuthenticationError
try:
result = client.search("query")
except AuthenticationError:
print("Check your API key")
except HeySolError as e:
print(f"API error: {e}")
Examples & Documentation
- Interactive Notebooks:
quick_start_python.ipynb,quick_start_cli.ipynb - Code Examples: See
examples/directory - Full Documentation:
docs/API_DOCUMENTATION.md
Testing
pytest # Run all tests
pytest --cov=heysol # With coverage
pytest -m "unit" # Unit tests only
Development
git clone https://github.com/heysol/heysol-python-client.git
cd heysol-python-client
pip install -e ".[dev]"
pre-commit install
License
MIT License - see LICENSE file for details.
Support
- 📧 Email: dev@heysol.ai
- 📖 Docs: https://docs.heysol.ai/api-reference
- 🐛 Issues: https://github.com/heysol/heysol-python-client/issues
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 heysol_api_client-0.9.0.tar.gz.
File metadata
- Download URL: heysol_api_client-0.9.0.tar.gz
- Upload date:
- Size: 35.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672633b2a9d371de980fc9342cf1f40d5a28f7cbc151afc128b926389c3510ed
|
|
| MD5 |
3b03db9b7e18bcdbb6b28c7105b3e1a3
|
|
| BLAKE2b-256 |
6b3063939a7ab749191212cfa9c2127dd1910150f87769275f5883393cfe050d
|
File details
Details for the file heysol_api_client-0.9.0-py3-none-any.whl.
File metadata
- Download URL: heysol_api_client-0.9.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
513f73c25cfa262daceaaf8e70e9d7626943d2b642b7e73782c4233bce154b82
|
|
| MD5 |
477a6fcba216fe608f5c23a529d61809
|
|
| BLAKE2b-256 |
6db34acff4291a4f3fd1b2db3f90fe3001ce3ec6242e9a5da62f25daa8a43c6b
|