🪄 Auto-Discovery

Drop tools in
/tools/ and they just work

Magic auto-discovery system that finds and loads your custom AI tools automatically. Zero configuration, maximum productivity.

The Magic in Action

Create a tool file and watch it instantly become available

1. Create your tool

tools/weather_tool.py
 from cogency.tools.base import BaseTool class WeatherTool(BaseTool): def __init__(self): super().__init__( name="weather", description="Get weather info" ) async def run(self, city): # Your weather logic return "temp": "22°C" 

2. Use it immediately

agent.py
 from cogency.agent import Agent # Agent automatically finds your tool! agent = Agent(name="Helper") # Weather tool is automatically available result = await agent.run( "What's the weather in Tokyo?" ) # Agent: "I'll check the weather for you!" # *automatically calls weather tool* # Agent: "It's 22°C in Tokyo" 

Pure magic! No imports, no registration, no configuration. Just drop the file and it works.

How the Magic Works

1

Scan & Discover

Cogency automatically scans your tools/ directory for Python files containing tool classes at startup.

2

Load & Register

Found tools are dynamically imported, instantiated, and registered with the agent's tool registry.

3

Ready to Use

Your agent can immediately use any discovered tools through natural language requests and reasoning.

Simple File Structure

Organize tools however you want

project structure
 my_project/
├── agent.py # Your main agent
└── tools/ # Magic directory
├── weather_tool.py # ✨ Auto-discovered
├── database_tool.py # ✨ Auto-discovered
├── email_tool.py # ✨ Auto-discovered
└── integrations/ # Subdirectories work too!
├── slack_tool.py # ✨ Auto-discovered
└── stripe_tool.py # ✨ Auto-discovered 

Advanced Discovery Features

Smart Filtering

  • Only loads valid tool classes
  • Ignores test files and __pycache__
  • Handles import errors gracefully
  • Validates tool interfaces

Hot Reloading

  • Detects new tool files automatically
  • Reloads modified tools in development
  • Zero downtime tool updates
  • File watcher integration

Ready for Magic Tool Loading?

Experience the productivity boost of auto-discovery