An enterprise-grade Python library for quickly setting up APIs to interact with AI Agents
Project description
Insight Ingenious
An enterprise-grade Python library for quickly setting up APIs to interact with AI Agents, featuring tight integrations with Microsoft Azure services and comprehensive utilities for debugging and customization.
Quick Start
Get up and running in 5 minutes with Azure OpenAI!
Prerequisites
- Python 3.13 or higher
- Azure OpenAI API credentials
- uv package manager
5-Minute Setup
-
Install and Initialize:
# From your project directory - choose installation based on features needed uv add ingenious[standard] # Most common: includes SQL agent support # OR uv add ingenious[azure-full] # Full Azure integration # OR uv add ingenious # Minimal installation # Add required dependencies for knowledge-base and SQL workflows uv add chromadb aiofiles autogen-ext # Initialize project uv run ingen init
-
Configure Credentials: Copy the example template and add your Azure OpenAI credentials:
# Copy environment template (choose based on your needs) cp .env.example .env # Full configuration options # OR cp .env.development .env # Minimal development setup # OR cp .env.azure-full .env # Full Azure integration # Edit .env file with your actual credentials nano .env
Required configuration (add to .env file):
# Azure OpenAI Configuration AZURE_OPENAI_API_KEY=your-api-key-here AZURE_OPENAI_BASE_URL=https://your-resource.openai.azure.com/ # Model Configuration (pydantic-settings format) INGENIOUS_MODELS__0__MODEL=gpt-4.1-nano INGENIOUS_MODELS__0__API_TYPE=rest INGENIOUS_MODELS__0__API_VERSION=2024-12-01-preview INGENIOUS_MODELS__0__DEPLOYMENT=gpt-4.1-nano INGENIOUS_MODELS__0__API_KEY=your-actual-api-key-here INGENIOUS_MODELS__0__BASE_URL=https://your-resource.openai.azure.com/ # Basic required settings INGENIOUS_CHAT_SERVICE__TYPE=multi_agent INGENIOUS_CHAT_HISTORY__DATABASE_TYPE=sqlite INGENIOUS_CHAT_HISTORY__DATABASE_PATH=./.tmp/chat_history.db INGENIOUS_CHAT_HISTORY__MEMORY_PATH=./.tmp
-
Validate Configuration:
uv run ingen validate # Check configuration before starting
Note: Ingenious now uses pydantic-settings for configuration via environment variables. Legacy YAML configuration files (
config.yml,profiles.yml) are no longer supported and must be migrated to environment variables withINGENIOUS_prefixes using the migration script atscripts/migrate_config.py. -
Start the Server:
# Start server on port 8000 (override default port 80) uv run ingen serve --port 8000
-
Verify Health:
# Check server health curl http://localhost:8000/api/v1/health
-
Test with Core Workflows:
Create test files to avoid JSON escaping issues:
# Create test files for each workflow echo '{"user_prompt": "Analyze this customer feedback: Great product", "conversation_flow": "classification-agent"}' > test_classification.json echo '{"user_prompt": "Search for documentation about setup", "conversation_flow": "knowledge-base-agent"}' > test_knowledge.json echo '{"user_prompt": "Show me all tables in the database", "conversation_flow": "sql-manipulation-agent"}' > test_sql.json # Test each workflow curl -X POST http://localhost:8000/api/v1/chat -H "Content-Type: application/json" -d @test_classification.json curl -X POST http://localhost:8000/api/v1/chat -H "Content-Type: application/json" -d @test_knowledge.json curl -X POST http://localhost:8000/api/v1/chat -H "Content-Type: application/json" -d @test_sql.json
That's it! You should see a JSON response with AI analysis of the input.
Next Steps - Test Additional Workflows:
-
Test bike-insights Workflow (Requires
ingen initfirst):The
bike-insightsworkflow is part of the project template and must be initialized first:# First initialize project to get bike-insights workflow ingen init # Create bike-insights test data file cat > test_bike_insights.json << 'EOF'
{ "user_prompt": "{"revision_id": "test-v1", "identifier": "test-001", "stores": [{"name": "Test Store", "location": "NSW", "bike_sales": [{"product_code": "MB-TREK-2021-XC", "quantity_sold": 2, "sale_date": "2023-04-01", "year": 2023, "month": "April", "customer_review": {"rating": 4.5, "comment": "Great bike"}}], "bike_stock": []}]}", "conversation_flow": "bike-insights" } EOF
# Test bike-insights workflow
curl -X POST http://localhost:8000/api/v1/chat -H "Content-Type: application/json" -d @test_bike_insights.json
```
Important Notes:
- Core Library Workflows (
classification-agent,knowledge-base-agent,sql-manipulation-agent) are always available and accept simple text prompts - Template Workflows like
bike-insightsrequire JSON-formatted data with specific fields and are only available after runningingen init - The
bike-insightsworkflow is the recommended "Hello World" example for new users
CLI Commands
Core commands:
ingen init- Initialize a new project with templates and configurationingen serve- Start the API server with web interfaceingen workflows [workflow_name]- List available workflows and their requirementsingen test- Run agent workflow testsingen validate- Validate system configuration and requirementsingen help [topic]- Show detailed help and getting started guideingen status- Check system status and configurationingen version- Show version information
Data processing commands:
ingen document-processing extract <path>- Extract text from documents (PDF, DOCX, images)ingen dataprep crawl <url>- Web scraping utilities using Scrapfly
Help and information:
ingen --help- Show comprehensive helpingen <command> --help- Get help for specific commands
For complete CLI reference, see docs/CLI_REFERENCE.md.
API Endpoints
When the server is running, the following endpoints are available:
Core API:
POST /api/v1/chat- Chat with AI workflowsGET /api/v1/health- Health check endpoint
Diagnostics:
GET /api/v1/workflows- List all workflows and their statusGET /api/v1/workflow-status/{workflow_name}- Check specific workflow configurationGET /api/v1/diagnostic- System diagnostic information
Prompt Management:
GET /api/v1/revisions/list- List available prompt revisionsGET /api/v1/workflows/list- List workflows with promptsGET /api/v1/prompts/list/{revision_id}- List prompt templates for revisionGET /api/v1/prompts/view/{revision_id}/{filename}- View prompt contentPOST /api/v1/prompts/update/{revision_id}/{filename}- Update prompt template
Authentication (if enabled):
POST /api/v1/auth/login- JWT loginPOST /api/v1/auth/refresh- Refresh JWT tokenGET /api/v1/auth/verify- Verify JWT token
Web Interfaces:
- API documentation available at
/docs
Additional Routes:
GET /api/v1/conversations/{thread_id}- Retrieve conversation historyPUT /api/v1/messages/{message_id}/feedback- Submit message feedback
Workflow Categories
Insight Ingenious provides multiple conversation workflows with different configuration requirements:
Core Library Workflows (Always Available)
These workflows are built into the Ingenious library and available immediately:
classification-agent- Route input to specialized agents based on content (Azure OpenAI only)knowledge-base-agent- Search knowledge bases using local ChromaDB (STABLE - recently fixed)sql-manipulation-agent- Execute SQL queries using local SQLite (STABLE - recently fixed)
Note: Core workflows support both hyphenated (
classification-agent) and underscored (classification_agent) naming formats for backward compatibility.
Template Workflows (Available via ingen init)
These workflows are created when you initialize a new project and serve as examples for custom development:
bike-insights- Comprehensive bike sales analysis showcasing multi-agent coordination (Created byingen init- demonstrates custom workflow development)
Note: The
bike-insightsworkflow is the recommended starting point and "Hello World" example for new Ingenious users. It's only available after runningingen initto create the project template.
Configuration Requirements by Workflow
- Minimal setup (Azure OpenAI only):
classification-agent,bike-insights - Local implementations (STABLE):
knowledge-base-agent(ChromaDB),sql-manipulation-agent(SQLite) - Azure integrations (EXPERIMENTAL): Azure Search for knowledge base, Azure SQL for database queries
Important: Local implementations (ChromaDB, SQLite) are stable and work out-of-the-box. Azure integrations are experimental and contain known bugs. For production use, stick with local implementations. Use
ingen workflowsto check configuration requirements for each workflow.
Required Dependencies
Some workflows require additional dependencies:
# For knowledge-base-agent (ChromaDB)
uv add chromadb
# For sql-manipulation-agent (SQLite support)
uv add aiofiles
# For updated autogen compatibility
uv add autogen-ext
Installation Options
Choose the installation option that matches your intended use case:
Minimal Installation
uv add ingenious
Includes: Core chat functionality, classification-agent workflow Use for: Basic API development, testing Azure OpenAI connectivity
Standard Installation (Recommended)
uv add ingenious[standard]
Includes: Core features + SQL agent support (pandas, database connectivity) Use for: Most production deployments with local database features
Azure Full Integration
uv add ingenious[azure-full]
Includes: Standard features + Azure services (Azure SQL, Blob Storage, Search) Use for: Full cloud deployment with Azure integrations
Complete Feature Set
uv add ingenious[full]
Includes: All features including document processing, ML capabilities, data preparation Use for: Advanced use cases requiring all available features
Knowledge Base Features
uv add ingenious[knowledge-base]
# OR manually install dependencies
uv add ingenious && uv add chromadb aiofiles autogen-ext
Includes: Core features + ChromaDB and ML capabilities for knowledge-base-agent Use for: Local knowledge base and search functionality (STABLE)
Project Structure
-
ingenious/: Core framework codeapi/: FastAPI routes and endpointsroutes/: Individual route modules (auth, chat, diagnostic, etc.)
auth/: JWT authentication and securitycli/: Command-line interface modulescommands/: Individual command implementations
config/: Configuration management (pydantic-settings based)main_settings.py: Primary settings classmodels.py: Configuration model definitionsenvironment.py: Environment handling
core/: Core logging and error handlingdataprep/: Web scraping and data preparation utilitiesdb/: Database integration (SQLite and Azure SQL)document_processing/: PDF/document text extractionerrors/: Custom exception classesexternal_services/: OpenAI and other service integrationsfiles/: File storage (local and Azure Blob)main/: FastAPI application factory and middlewaremodels/: Pydantic data models and schemasservices/: Core business logic and serviceschat_services/multi_agent/: Multi-agent conversation flowsconversation_flows/: Individual workflow implementations
templates/: Jinja2 prompt templates and HTMLutils/: Utility functions and helpersingenious_extensions_template/: Template for custom projectsservices/chat_services/multi_agent/conversation_flows/bike_insights/: Sample workflow
-
scripts/: Utility scriptsmigrate_config.py: Migrate YAML configs to environment variables
-
tests/: Test suiteunit/: Unit testsintegration/: Integration tests
Documentation
For detailed documentation, see the docs or view locally in the docs/ directory.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the terms specified in the LICENSE file.
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 ingenious-0.2.0.tar.gz.
File metadata
- Download URL: ingenious-0.2.0.tar.gz
- Upload date:
- Size: 302.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58c5b0e47096064cc5393c4d55d225fc37a5769b0c4760920f6d9bac675e6b01
|
|
| MD5 |
b429fd2c267da03386066a75bc8ae887
|
|
| BLAKE2b-256 |
4852e45c5ee73cc1cf7c384b5e80bfc0b389a95c77107047520058af79a1a5f0
|
Provenance
The following attestation bundles were made for ingenious-0.2.0.tar.gz:
Publisher:
publish.yml on Insight-Services-APAC/ingenious
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ingenious-0.2.0.tar.gz -
Subject digest:
58c5b0e47096064cc5393c4d55d225fc37a5769b0c4760920f6d9bac675e6b01 - Sigstore transparency entry: 280159109
- Sigstore integration time:
-
Permalink:
Insight-Services-APAC/ingenious@0b6e8f36473b8e11b06b9d63b100f5690a8fb750 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Insight-Services-APAC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0b6e8f36473b8e11b06b9d63b100f5690a8fb750 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ingenious-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ingenious-0.2.0-py3-none-any.whl
- Upload date:
- Size: 377.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b0fad43103512287b5fefd5b5dc36571fe7994c6cb263118dbc71e7c555246
|
|
| MD5 |
1128996f15e0e8e8ce7d8494c2376ab6
|
|
| BLAKE2b-256 |
30a4a7fdf800847b534d7ce25d15f9225199ca45ac909b72d1271d962b831270
|
Provenance
The following attestation bundles were made for ingenious-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Insight-Services-APAC/ingenious
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ingenious-0.2.0-py3-none-any.whl -
Subject digest:
61b0fad43103512287b5fefd5b5dc36571fe7994c6cb263118dbc71e7c555246 - Sigstore transparency entry: 280159127
- Sigstore integration time:
-
Permalink:
Insight-Services-APAC/ingenious@0b6e8f36473b8e11b06b9d63b100f5690a8fb750 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Insight-Services-APAC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0b6e8f36473b8e11b06b9d63b100f5690a8fb750 -
Trigger Event:
workflow_dispatch
-
Statement type: