BlaskAPIAgentManager
BlaskAPIAgentManager is a Python library that provides a sophisticated pipeline for interacting with the Blask API based on Swagger specifications. It automates API discovery, planning, and execution to retrieve relevant data based on natural language queries.
Features
- Automatic API Planning: Intelligently plans the right API calls based on natural language queries
- API Call Orchestration: Executes API calls in the optimal order with proper parameters
- Data Enrichment: Automatically enriches data by resolving IDs to human-readable names
- Result Synthesis: Summarizes API responses into coherent, user-friendly answers
- RAG Enhancement: Can enhance Retrieval-Augmented Generation answers with live API data
Installation
Quick Install with pip
pip install BlaskAPIAgentManager
Install with uv (Recommended)
For a faster, more reliable installation, you can use uv, a Python packaging tool for fast installation:
# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install BlaskAPIAgentManager with uv
uv pip install BlaskAPIAgentManager
Local Development Installation
For local development or contributing to the project:
- Clone the repository:
git clone https://gitlab.private.blask.com/blask/ml-ai/blaskapiagentmanager
cd blaskapiagentmanager
- Create and activate a virtual environment:
Using standard venv:
# Create virtual environment
python -m venv venv
# Activate on macOS/Linux
source venv/bin/activate
# Activate on Windows
venv\Scripts\activate
Using uv (recommended):
# Create virtual environment
uv venv
# Activate on macOS/Linux
source .venv/bin/activate
# Activate on Windows
.venv\Scripts\activate
- Install the package in development mode:
# Using standard pip
pip install -e .
# Using uv (recommended)
uv pip install -e .
Configuration
Create a .env file in your project root with the following variables:
BLASK_USERNAME=your_username
BLASK_PASSWORD=your_password
OPENROUTER_API_KEY=your_openrouter_api_key
SWAGGER_JSON_URL=link_to_swagger_json
LOGIN_URL=link_to_login
BASE_URL=base_api_url
Usage
Basic Usage
from BlaskAPIAgentManager import BlaskPipeline
# Initialize the pipeline
pipeline = BlaskPipeline()
# Process a natural language query
result = pipeline.process_query("What are the top 5 performing countries by GGR in the last 3 months?")
# Print the summary
print(result["summary"])
# Access the raw data
api_data = result["data"]
Components
- BlaskAPIAgentManager: The name of the Python package.
- BlaskPipeline: Main orchestrator that manages the entire workflow from query to summarized result.
- BlaskAPIAgent: Core agent for authenticating and interacting with the Blask API.
- PlannerTool: Plans the sequence of API calls based on natural language queries.
- ProcessorTool: Processes raw API responses by filtering, sorting, and aggregating data.
Development
To contribute to this project:
- Clone the repository
- Create and activate a virtual environment (see Local Development Installation section)
- Install development dependencies:
uv pip install -e ".[dev]"
-
Set up environment variables for testing:
- Create a
.envfile in the project root with your Blask API credentials - Tests will skip API-dependent tests if credentials are not available
- Create a
-
Run tests:
# Run all tests
python -m unittest discover
# Run specific test files
python -m unittest tests.test_basic
python -m unittest tests.test_api_agents
Note that tests in test_api_agents.py require valid API credentials and will be skipped if they're not available.
License
MIT
Support
For support, please contact elijah@blask.com.
Metadata
Release files for BlaskAPIAgentManager 0.1.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blaskapiagentmanager-0.1.22.tar.gz | 40.3 kB | Without provenance | Details for blaskapiagentmanager-0.1.22.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blaskapiagentmanager-0.1.22-py3-none-any.whl | Python 3 | none | any | Details for blaskapiagentmanager-0.1.22-py3-none-any.whl |
Total release size: 86.4 kB
Release files / blaskapiagentmanager-0.1.22.tar.gz
| Download URL | blaskapiagentmanager-0.1.22.tar.gz |
|---|---|
| Size | 40.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b117a82115d429422e9bf1094c5ea5d7dffb8c7b27cb57a69b812e9e58e27b04
|
|
BLAKE2b-256 checksum How to use checksums |
6ecd55736b96bd4af193af5f18de7b1cbd06ffac8a47810e62ff5eac0b731deb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / blaskapiagentmanager-0.1.22-py3-none-any.whl
| Download URL | blaskapiagentmanager-0.1.22-py3-none-any.whl |
|---|---|
| Size | 46.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cb453afb78f836887ed217e4b7aaac58d5cd0ecb217be25776498f12e7dcbe1
|
|
BLAKE2b-256 checksum How to use checksums |
c351efef3dcd73b67fa0f08fb468860e7564ab6c29d966f58fd0edb979a54898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for BlaskAPIAgentManager 0.1.22
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.