A powerful, modular AI agent framework for building intelligent web search and document analysis applications. This template provides a complete foundation for creating AI agents with tool integration, search capabilities, and document processing features.
- Intelligent web search with multiple query breakdown
- Structured response format with references and explanations
- Integration with Gensee search platform
- Support for PDF and web content extraction
- Plugin-based tool system
- MCP (Model Context Protocol) support
- Configurable LLM backends
- Extensible prompt management
- FastAPI REST endpoints
- Slack integration
- Web interface for testing
- Command-line interface
- Python 3.12+
- OpenAI API key (or compatible LLM service)
- Gensee platform API key (for search functionality)
-
Clone the repository:
git clone <repository-url> cd agent-template
-
Install dependencies:
pip install -e . -
Set up environment variables:
cp src/deep_search/app/config.json.example src/deep_search/app/config.json # Edit config.json with your API keys and settings
cd src/deep_search/app
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadcd src/slack_interface/app
python main.pyGET /healthzPOST /agent/deep-search
Content-Type: application/json
{
"query": "What is the capital of France?"
}The agent system uses JSON configuration files for customization:
{
"controller": {
"name": "deep_search_agent",
"allow_user_interaction": false,
"streaming": false
},
"llm_manager": {
"model_name": "gpt-4",
"api_key": "your-openai-api-key"
},
"tools": {
"gensee.search": {
"gensee_api_key": "your-gensee-api-key"
}
}
}gensee.search: Web search using Gensee platformgensee.letter_counter: Text analysis utilitiessystem.user_interaction: User interaction handling- ...
The framework supports Model Context Protocol (MCP) for external tool integration:
- File system operations
- Database queries
- External API integrations
- Custom business logic
src/
├── gensee_agent/ # Core agent framework
│ ├── controller/ # Main controller logic
│ ├── models/ # LLM integrations (OpenAI, etc.)
│ ├── tools/ # Tool implementations
│ ├── prompts/ # Prompt templates
│ └── configs/ # Configuration management
├── deep_search/ # Deep search application
└── slack_interface/ # Slack bot implementation
- Controller: Orchestrates the entire agent workflow
- LLM Manager: Handles language model interactions
- Tool Manager: Manages tool registration and execution
- Prompt Manager: Template-based prompt generation
- Task Manager: Coordinates task execution and streaming
- Create a new tool class inheriting from
BaseTool:
from gensee_agent.tools.base import BaseTool, public_api, register_tool
class MyCustomTool(BaseTool):
@public_api
async def my_function(self, param: str) -> str:
"""Tool function description."""
return f"Processed: {param}"
register_tool("my_custom_tool", MyCustomTool)- Register the tool in your configuration:
{
"tools": {
"my_custom_tool": {}
}
}Create custom prompt templates using Jinja2:
TEMPLATE = """
You are a specialized agent for {{domain}}.
Your task is: {{objective}}
Available tools: {{tools}}
"""- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
For questions and support:
- Create an issue in the repository
- Contact the development team
- Check the documentation in the
docs/directory