TAgent - Modular AI Agent Framework with Dynamic Tool Discovery
Project description
๐ค TAgent - Modular AI Agent Framework
Build powerful AI agents with modular tools and automatic discovery
TAgent is a production-ready framework for creating AI agents with modular, reusable tools. It features automatic tool discovery, dynamic schema loading, and a powerful CLI for rapid development and deployment.
Built on LiteLLM - Universal LLM API for seamless integration with 100+ language models including OpenAI, Anthropic, Azure, Google, and local models.
โจ Key Features
- ๐ Automatic Tool Discovery - Finds and loads
tagent.tools.pyfiles automatically - ๐๏ธ Modular Architecture - Reusable tools across different projects
- ๐ Dynamic Schema Loading - Pydantic schemas from
tagent.output.pyfiles - ๐ Production CLI - Professional command-line interface with console scripts
- ๐ Intelligent Agent Loop - Adaptive planning, execution, and evaluation
- ๐ ๏ธ Rich Tool Ecosystem - Travel planning, e-commerce, and custom tools
- ๐ฏ Type-Safe Output - Structured results with Pydantic validation
- ๐ Comprehensive Logging - Beautiful retro-style terminal output
๐ Quick Start
Installation
# Clone the repository
git clone https://github.com/Tavernari/tagent.git
cd tagent
# One-command setup (creates venv, installs everything)
make clean-install
# Activate virtual environment
source .venv/bin/activate
Basic Usage
# Test the CLI with built-in travel tools
tagent "Plan a trip from London to Rome for 2025-09-10 to 2025-09-17 with budget $2000" \
--search-dir examples/travel_planning_cli \
--max-iterations 10
# Quick discovery test
make cli-discovery-test
# See all available commands
make help
๐ Creating Your Own Tools
1. Create Tool Functions (myproject/tagent.tools.py)
from typing import Dict, Any, Tuple, Optional
def web_search_tool(state: Dict[str, Any], args: Dict[str, Any]) -> Optional[Tuple[str, Any]]:
"""Search the web for information."""
query = args.get('query', '')
# Your implementation here
results = perform_web_search(query)
return ('search_results', results)
def data_analysis_tool(state: Dict[str, Any], args: Dict[str, Any]) -> Optional[Tuple[str, Any]]:
"""Analyze data and generate insights."""
data = args.get('data', [])
# Your analysis logic
insights = analyze_data(data)
return ('analysis_insights', insights)
2. Define Output Schema (myproject/tagent.output.py)
from pydantic import BaseModel, Field
from typing import List
class ResearchReport(BaseModel):
title: str = Field(..., description="Report title")
summary: str = Field(..., description="Executive summary")
findings: List[str] = Field(default=[], description="Key findings")
recommendations: List[str] = Field(default=[], description="Actionable recommendations")
confidence_score: float = Field(..., description="Confidence in results (0-1)")
# Required variable name
output_schema = ResearchReport
3. Run Your Agent
tagent "Research the latest trends in AI and create a comprehensive report" \
--search-dir myproject \
--model openrouter/ollama/gemma3 \
--verbose
๐ฏ Examples
Travel Planning Agent
# Complete travel itinerary with flights, hotels, activities
tagent "Plan a 7-day trip to Tokyo with cultural activities and budget $3000" \
--search-dir examples/travel_planning_cli
E-commerce Analysis
# Business intelligence and product recommendations
tagent "Analyze customer data and suggest product improvements" \
--search-dir examples/ecommerce \
--model openrouter/ollama/gemma3
Custom Research
# Multi-source research with structured output
tagent "Research sustainable energy trends and create executive summary" \
--tools ./research/tagent.tools.py \
--output ./research/tagent.output.py
๐ ๏ธ CLI Commands
Development Commands
make help # Show all commands
make install # Install in virtual environment
make clean-install # Clean install (recommended)
make test # Run test suite
make lint # Code quality checks
make format # Format code with black
CLI Commands
make cli-help # Show CLI help
make cli-discovery-test # Test tool discovery
make cli-test # Full travel example
make cli-demo # Generate demo GIF
# Direct CLI usage (after source .venv/bin/activate)
tagent --help
tagent "your goal" --search-dir path/to/tools
๐๏ธ Architecture
TAgent Framework
โโโ ๐ Tool Discovery Engine
โ โโโ Automatic file scanning
โ โโโ Function signature validation
โ โโโ Dynamic imports
โโโ ๐ค Intelligent Agent Core
โ โโโ LLM-powered decision making (via LiteLLM)
โ โโโ Adaptive planning
โ โโโ Tool execution
โ โโโ Goal evaluation
โโโ ๐ Schema Management
โ โโโ Pydantic integration
โ โโโ Type-safe outputs
โ โโโ Validation
โโโ ๐ Production CLI
โโโ Console scripts
โโโ Rich terminal UI
โโโ Error handling
๐ง Core Dependencies
- LiteLLM - Universal LLM integration supporting 100+ models
- Pydantic - Type-safe data validation and schemas
- Rich - Beautiful terminal UI and progress indicators
๐ Built-in Tools
Travel Planning (examples/travel_planning_cli/)
- โ๏ธ Flight search with budget filtering
- ๐จ Hotel recommendations with preferences
- ๐ฏ Activity suggestions by interest
- ๐ฐ Cost calculation and budgeting
- ๐ Itinerary generation
E-commerce (examples/ecommerce/)
- ๐ Sales analysis and trends
- ๐ฅ Customer behavior insights
- ๐๏ธ Product recommendations
- ๐ก Business intelligence
๐ง Advanced Usage
Custom Models
# Use different LLM providers
tagent "goal" --model openrouter/google/gemma3
tagent "goal" --model openrouter/ollama/gemma3
tagent "goal" --model openrouter/openai/04-mini
For a complete list of supported models and integrations, please visit the LiteLLM Provider Documentation.
Multiple Tool Directories
# Search multiple directories
tagent "complex task" \
--search-dir ./core-tools \
--search-dir ./specialized-tools \
--search-dir ./custom-tools \
--recursive
API Configuration
# Set API key
export OPENAI_API_KEY="your-key"
# or
tagent "goal" --api-key your-key-here
๐ฌ Demo
Generate an animated demo:
make cli-demo # Creates examples/tagent_cli_demo.gif
๐ค Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Follow code style:
make format && make lint - Add tests:
pytest tests/ - Commit changes:
git commit -m "Add amazing feature" - Push branch:
git push origin feature/amazing-feature - Open Pull Request
Development Setup
git clone https://github.com/Tavernari/tagent.git
cd tagent
make clean-install
source .venv/bin/activate
make test
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Why TAgent?
- ๐ฅ Rapid Development: Create agents in minutes, not hours
- ๐ง Modular Design: Reuse tools across projects
- ๐ Production Ready: Professional CLI and error handling
- ๐ฏ Type Safety: Pydantic schemas ensure data integrity
- ๐ค Intelligent: LLM-powered adaptive behavior
- ๐ Scalable: From prototypes to production systems
๐ Star History
If TAgent helps you build amazing AI agents, please give it a โญ!
Built with โค๏ธ for the AI community
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 tagent-0.2.3.tar.gz.
File metadata
- Download URL: tagent-0.2.3.tar.gz
- Upload date:
- Size: 58.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f45da7f46223826eab75b90a5336d44a87c57ac5b570222e785553edb16eec0a
|
|
| MD5 |
23628226311d755da2c62e549d7f91ec
|
|
| BLAKE2b-256 |
719ba0413d9581f45dae795d89ddf512d87f04d9cb26000e7c7376ba35e85538
|
File details
Details for the file tagent-0.2.3-py3-none-any.whl.
File metadata
- Download URL: tagent-0.2.3-py3-none-any.whl
- Upload date:
- Size: 36.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36447567badf6650b755ee1cedd4187fc12e0ceaa8c29b14c092ca35bfa17516
|
|
| MD5 |
46f0c55c8130c9f8c02697753c211ad1
|
|
| BLAKE2b-256 |
b475e2a2272b7adbc6861bb52e7a0d3c42ffd978acd0b0f677bbb78ad1819f99
|