AI Agent
import logging
from gunicorn.app.base import BaseApplication
from app_init import create_initialized_flask_app
# Flask app creation should be done by create_initialized_flask_app to avoid circular dependency problems.
app = create_initialized_flask_app()
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
self.application = app
self.options = options or {}
super().__init__()
def load_config(self):
# Apply configuration to Gunicorn
for key, value in self.options.items():
if key in self.cfg.settings and value is not None:
self.cfg.set(key.lower(), value)
def load(self):
Frequently Asked Questions
Content Creation - Use the agent to help generate and review content following brand guidelines Q2: How does the team management feature benefit organizations?
The AI Agent's team management system provides several key benefits: - Domain-based Access: Add entire company domains (e.g., "@yourcompany.com") to automatically grant access to all employees - Individual Control: Add or remove specific team members regardless of their email domain - Role Management: Designate admins who can modify the agent's behavior and settings - Security: Block specific users while maintaining domain-wide access for others - Audit Trail: Track who makes changes to the agent's configuration
Q3: What makes this template more secure than using a public AI chatbot? A: The AI Agent template offers several security advantages:
Team Oversight: Administrators can monitor and adjust usage patterns Q4: How can I modify the temperature setting for different use cases? Can you show an example?
The AI Agent allows dynamic temperature adjustment through the settings API. Here's a code example:
```python @app.route("/api/update_settings", methods=["POST"]) def update_settings(): try: settings = ChatbotSettings.query.first() if not settings: settings = ChatbotSettings() db.session.add(settings)
# Set lower temperature (0.3) for more focused, consistent responses
# Set higher temperature (0.8) for more creative responses
settings.temperature = float(request.form.get("temperature", 0.7))
db.session.commit()
return jsonify({"status": "success"})
except Exception as e:
return jsonify({"status": "error", "message": str(e)})
```
Q5: How can I add custom validation for allowed email domains? Can you provide a code example? A: You can extend the AI Agent's domain validation by adding custom rules. Here's an example:
```python @app.route("/api/allowed_email_endings/create", methods=["POST"]) def api_create_allowed_email_ending(): email_ending = request.json.get('email_ending')
# Custom validation rules
if not email_ending:
return jsonify({"status": "error", "message": "Email ending required"})
# Remove '@' if included
email_ending = email_ending.lstrip('@')
# Validate domain format
if not re.match(r'^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$', email_ending):
return jsonify({"status": "error", "message": "Invalid domain format"})
try:
new_ending = AllowedEmailEndings(email_ending=email_ending)
db.session.add(new_ending)
db.session.commit()
return jsonify({"status": "success"})
except Exception as e:
return jsonify({"status": "error", "message": str(e)})
```
Created: | Last Updated:
Here's how to use this template to create a customizable AI agent with team management:
Introduction
This template provides a web-based dashboard for configuring and testing an AI agent that can be customized with specific instructions, model selection, and response parameters. It includes team management features to control access through email domains and individual permissions.
Getting Started
- Click "Start with this Template" to begin
- This will create your instance of the AI agent dashboard
Test the Application
- Click the "Test" button to deploy your instance
- The application will launch and provide you with a server link to access the dashboard
Using the Dashboard
Configure AI Settings
- On the main dashboard page:
- Enter custom instructions for your AI agent in the "Chatbot Instructions" field
- Choose an AI model from the dropdown (GPT-4, Claude, Gemini options)
- Adjust the temperature slider to control response creativity (0-2)
- Click "Save Changes" to update the configuration
Manage Team Access
- Navigate to the "Team" page to:
- Add allowed email domains (e.g., "company.com")
- Add individual admin email addresses
- Block/unblock specific users
- View current team members
Test the AI Agent
- Click "Open Simulator" or go to the "AI Chat" page
- Enter test messages to see how your agent responds
- The agent will use your saved configuration settings
- Clear the chat history using the "Clear This Chat" button
The dashboard provides real-time testing of your AI agent's behavior based on your configuration. You can iteratively adjust the settings and test responses until you achieve the desired interaction style for your use case.
This template serves as a foundation for creating AI agents that can be integrated into other applications through the API endpoints. The team management features ensure controlled access to the configuration interface.
Template Benefits
-
Customizable AI Response Control - Organizations can fine-tune their AI agent's behavior through detailed instructions and temperature settings, ensuring responses align with company voice, policies, and compliance requirements.
-
Enterprise-Grade Access Management - Built-in team management features allow organizations to control access through domain-level permissions and individual user management, making it ideal for corporate deployments.
-
Multi-Model Flexibility - Support for multiple AI models (GPT-4, Claude, Gemini) gives businesses the freedom to choose the best model for their needs based on performance, cost, or specific capabilities.
-
Real-Time Testing Environment - The integrated simulator allows teams to test and validate AI responses before deployment, reducing the risk of inappropriate or incorrect responses in production.
-
Scalable Team Collaboration - The platform enables multiple team members to collaborate on AI agent configuration, with role-based access control and the ability to block/unblock users, making it suitable for growing organizations.
Technologies





