An enterprise-grade Python library for quickly setting up APIs to interact with AI Agents
Project description
Insight Ingenious
Ingenious is a tool for quickly setting up APIs to interact with AI Agents. It features multi-agent conversation flows using Microsoft's AutoGen, JWT authentication, and comprehensive Azure service integrations.
Quick Start
Get up and running in 5 minutes with Azure OpenAI!
Prerequisites
- Python 3.13 or higher (required - earlier versions are not supported)
- Azure OpenAI API credentials
- uv package manager
5-Minute Setup
-
Install and Initialize:
# Navigate to your desired project directory first cd /path/to/your/project # Set up the uv project uv init # Choose installation based on features needed uv add "ingenious[azure-full]" # Recommended: Full Azure integration (core, auth, azure, ai, database, ui) # OR uv add "ingenious[standard]" # for local testing: includes SQL agent support (core, auth, ai, database) # Initialize project in the current directory uv run ingen init
-
Configure Credentials: Create a
.envfile with your Azure OpenAI credentials:# Create .env file in current directory touch .env # Edit .env file with your actual credentials
Required configuration (add to .env file):
# Model Configuration (only INGENIOUS_* variables are used by the system) 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=your-gpt4.1-nano-deployment-name 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 # Optional: Authentication settings (enabled by default) # INGENIOUS_WEB_CONFIGURATION__ENABLE_AUTHENTICATION=false # To disable auth
-
Validate Configuration:
uv run ingen validate # Check configuration before starting
If validation fails with port conflicts:
# Check if validation passes with different port INGENIOUS_WEB_CONFIGURATION__PORT=8001 uv run ingen validate # Or update your .env file before validating: echo "INGENIOUS_WEB_CONFIGURATION__PORT=8001" >> .env uv run ingen validate
⚠️ BREAKING CHANGE: 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. Use the migration script:uv run python scripts/migrate_config.py --yaml-file config.yml --output .env uv run python scripts/migrate_config.py --yaml-file profiles.yml --output .env.profiles
-
Start the Server:
# Start server on port 8000 (recommended for development) uv run ingen serve --port 8000 # Additional options: # --host 0.0.0.0 # Bind host (default: 0.0.0.0) # --port # Port to bind (default: 80 or $WEB_PORT env var) # --config config.yml # Legacy config file (deprecated - use environment variables) # --profile production # Legacy profile (deprecated - use environment variables)
-
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
Expected Responses:
- Successful classification-agent response: JSON with message analysis and categories
- Successful knowledge-base-agent response: JSON with relevant information retrieved (may indicate empty knowledge base initially)
- Successful sql-manipulation-agent response: JSON with query results or confirmation
If you see error responses, check the troubleshooting section above or the detailed troubleshooting guide.
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 uv run ingen init # Create bike-insights test data file # IMPORTANT: bike-insights requires JSON data in the user_prompt field (double-encoded JSON) # Method 1: Use printf for precise formatting (recommended) printf '%s\n' '{ "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" }' > test_bike_insights.json # Method 2: Alternative using echo (simpler but watch for shell differences) echo '{ "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" }' > test_bike_insights.json # Method 3: If heredoc is preferred, ensure proper EOF placement 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
Expected bike-insights response: JSON with comprehensive bike sales analysis from multiple agents (fiscal analysis, customer sentiment, summary, and bike lookup).
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
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- Simple text classification and routing to categories (minimal config required)knowledge-base-agent- Search and retrieve information from knowledge bases (requires Azure Search or uses local ChromaDB by default)sql-manipulation-agent- Execute SQL queries based on natural language (requires Azure SQL or uses local SQLite by default)
Note: Core workflows support both hyphenated (
classification-agent) and underscored (classification_agent) naming formats for backward compatibility.
Template Workflows (Created by ingen init)
These workflows are provided as examples in the project template when you run ingen init:
bike-insights- Comprehensive bike sales analysis showcasing multi-agent coordination (ONLY available afteringen init- not included in the core library)
Important: The
bike-insightsworkflow is NOT part of the core library. It's a template example that's created when you initialize a new project withingen init. This is the recommended "Hello World" example for learning how to build custom workflows.
Troubleshooting
For common issues like port conflicts, configuration errors, or workflow problems, see the detailed troubleshooting guide.
Documentation
For detailed documentation, see the docs.
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.3.tar.gz.
File metadata
- Download URL: ingenious-0.2.3.tar.gz
- Upload date:
- Size: 408.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2260f3412bf93871e696eb251ac5246a0f3b792b2875b7774afc22988665f8ab
|
|
| MD5 |
c185ab420c1d31478b56c2aa4af92fff
|
|
| BLAKE2b-256 |
825814865da457ed963d4233264348fd173dc47dd54f986e71916cfed2b1c0f2
|
Provenance
The following attestation bundles were made for ingenious-0.2.3.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.3.tar.gz -
Subject digest:
2260f3412bf93871e696eb251ac5246a0f3b792b2875b7774afc22988665f8ab - Sigstore transparency entry: 409133876
- Sigstore integration time:
-
Permalink:
Insight-Services-APAC/ingenious@bb3e11ce467c77c1bdfa43e46f5479a9e14bed8a -
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@bb3e11ce467c77c1bdfa43e46f5479a9e14bed8a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ingenious-0.2.3-py3-none-any.whl.
File metadata
- Download URL: ingenious-0.2.3-py3-none-any.whl
- Upload date:
- Size: 560.0 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 |
c60eb1101a286f96f01109a20804d5ad7ec093b698b92072d43aec897faa8d9b
|
|
| MD5 |
0203c12d72d09acdc2beaeabb337fbe2
|
|
| BLAKE2b-256 |
969392da7cdf14eed73fb22c3fddcb1e6bbefb5c1d8e997eb4b06a763464acc7
|
Provenance
The following attestation bundles were made for ingenious-0.2.3-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.3-py3-none-any.whl -
Subject digest:
c60eb1101a286f96f01109a20804d5ad7ec093b698b92072d43aec897faa8d9b - Sigstore transparency entry: 409133901
- Sigstore integration time:
-
Permalink:
Insight-Services-APAC/ingenious@bb3e11ce467c77c1bdfa43e46f5479a9e14bed8a -
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@bb3e11ce467c77c1bdfa43e46f5479a9e14bed8a -
Trigger Event:
workflow_dispatch
-
Statement type: