A secure multi-agent framework for building AI applications with a focus on security
Project description
TBH Secure Agents
A secure multi-agent framework by TBH.AI focused on high security, reliability, and safe AI orchestration.
This package provides tools and structures for building multi-agent systems with a strong emphasis on security principles. It enables developers to create, manage, and deploy teams of AI experts (agents) that can work together on complex tasks while maintaining robust security controls to prevent common vulnerabilities in AI systems.
TBH Secure Agents addresses critical security concerns in multi-agent systems including agent hijacking, data leakage, exploitation between agents, and reliability issues. The framework is designed for developers who need to build secure, production-ready multi-agent applications.
Developed by Saish at TBH.AI.
Key Features
- High Security Focus: Built with security best practices from the ground up, including:
- Agent hijacking prevention
- Data leakage protection
- Multi-agent exploitation prevention
- Reliability enhancements to reduce hallucinations
- Modular Expert Design: Easily define and customize experts with specific specialties and security profiles.
- Flexible Operation Management: Define complex workflows and operations with clear input/output specifications.
- Dynamic Guardrails: Pass runtime inputs to guide expert behavior and enforce constraints during deployment.
- Secure Communication: Mechanisms for secure inter-expert communication with context validation.
- Result Destination: Save operation and squad results to files in various formats (TXT, MD, HTML, JSON, CSV, PDF).
- Comprehensive Security Documentation: Detailed guides on security profiles, checkpoints, and implementation details.
Installation
The package is available on PyPI and can be installed with a simple pip command:
pip install tbh-secure-agents
Note that the package name uses hyphens (tbh-secure-agents) rather than underscores when installing with pip.
This package is licensed under the Apache License 2.0 with a custom addendum. While the code is open source, it includes specialized security implementations designed to protect multi-agent systems. The package provides you with the necessary interfaces and components to build secure multi-agent systems.
Documentation
Full documentation, including installation instructions, usage guides, and details on the security focus, can be found in the docs/ directory:
- Installation Guide
- Usage Guide
- Security Features
- Guardrails Guide
- Result Destination Guide
- Error Messages Guide
- Security Profiles Guide
- Version Changes
Examples
The examples/ directory contains various examples demonstrating the framework's capabilities:
- Basic Examples: Simple examples demonstrating core functionality
- Advanced Examples: More complex examples showcasing advanced features
- Security Examples: Examples focused on security features
- Result Destination Examples: Examples demonstrating the result_destination feature
- Guardrails Examples: Examples showing how to use guardrails
- New Version Example: A simple, readable example demonstrating all the key features of the latest version
Getting Started (Quick Example)
Here's a simple example of how to use the package:
from tbh_secure_agents import Expert, Operation, Squad
import os
# Create output directory
os.makedirs("output", exist_ok=True)
# Define experts with specific specialties and security profiles
content_writer = Expert(
specialty="Content Writer",
objective="Create engaging and informative content",
background="Experienced in creating clear, concise, and engaging content.",
security_profile="minimal" # Using minimal security for simplicity
)
data_analyst = Expert(
specialty="Data Analyst",
objective="Analyze data and provide insights",
background="Skilled in interpreting data and extracting meaningful insights.",
security_profile="minimal" # Using minimal security for simplicity
)
# Define operations with result destinations
content_operation = Operation(
instructions="Write a short blog post about the benefits of artificial intelligence in healthcare.",
output_format="A well-structured blog post with a title, introduction, main points, and conclusion.",
expert=content_writer,
result_destination="output/healthcare_ai_blog.md" # Save result to a markdown file
)
analysis_operation = Operation(
instructions="Analyze the following data and provide insights: Patient wait times decreased by 30% after implementing AI scheduling. Diagnostic accuracy improved by 15%. Treatment planning time reduced by 25%.",
output_format="A concise analysis with key insights and recommendations.",
expert=data_analyst,
result_destination="output/healthcare_data_analysis.txt" # Save result to a text file
)
# Create a squad with template variables in operations
template_expert = Expert(
specialty="Healthcare Specialist",
objective="Provide {output_type} about healthcare technology",
background="Expert in healthcare technology with a focus on {focus_area}.",
security_profile="minimal" # Using minimal security for simplicity
)
# Create an operation with template variables and conditional formatting
template_operation = Operation(
instructions="""
Write a {length} summary about {topic} in healthcare.
{tone, select,
formal:Use a professional, academic tone suitable for medical professionals.|
conversational:Use a friendly, approachable tone suitable for patients and the general public.|
technical:Use precise technical language appropriate for healthcare IT specialists.
}
{include_statistics, select,
true:Include relevant statistics and data points to support your summary.|
false:Focus on qualitative information without specific statistics.
}
""",
expert=template_expert,
result_destination="output/healthcare_summary.html" # Save result to an HTML file
)
# Form a squad with result destination
healthcare_squad = Squad(
experts=[content_writer, data_analyst, template_expert],
operations=[content_operation, analysis_operation, template_operation],
process="sequential", # Operations run in sequence, passing results as context
result_destination={
"format": "json",
"file_path": "output/healthcare_squad_result.json" # Save squad result to a JSON file
}
)
# Define guardrail inputs
guardrails = {
"output_type": "insights",
"focus_area": "AI implementation",
"length": "one-page",
"topic": "artificial intelligence",
"tone": "conversational",
"include_statistics": "true"
}
# Deploy the squad with guardrails
result = healthcare_squad.deploy(guardrails=guardrails)
print("Squad result:", result[:100] + "...") # Print a preview of the result
print("Results saved to the output directory")
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file (to be created) and refer to the documentation in the docs/ directory for project structure and goals.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
The Apache License 2.0 was chosen to provide a balance between open-source accessibility and protection for contributors. It allows for free use, modification, and distribution while requiring preservation of copyright and license notices. It also provides an express grant of patent rights from contributors to users.
Contact
TBH.AI Saish - saish.shinde.jb@gmail.com
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 tbh_secure_agents-0.3.2.tar.gz.
File metadata
- Download URL: tbh_secure_agents-0.3.2.tar.gz
- Upload date:
- Size: 156.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa6815c9cc437e4d89f3c8f1c9bb99d1c2de672eaca09fb82f60e427bd987ea7
|
|
| MD5 |
d203737dfe1643683bb9910836c34ae0
|
|
| BLAKE2b-256 |
f72924f7c2a94a118d9e128f68916ce1b9a81e21a98e24504f74884e8de6f6d0
|
File details
Details for the file tbh_secure_agents-0.3.2-py3-none-any.whl.
File metadata
- Download URL: tbh_secure_agents-0.3.2-py3-none-any.whl
- Upload date:
- Size: 81.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bfd71d935b93c3b34d7f309ca19c30d2cc10f31452d423af0dc30e21a9240f9
|
|
| MD5 |
46bf9e4f314983afb4a1685c4a013bb2
|
|
| BLAKE2b-256 |
b245aac5d6272c43dc346431f738165faa50340def0ab30d08dea65564092331
|