DB-ADK is a Python package that extends Google's Agent Development Kit (ADK) to create a fully database-driven approach for building and managing agent networks. This approach minimizes explicit Python coding by storing agent configurations, prompts, and tool definitions in a SQLite database.
- Database-Driven: Store all agent and tool configurations in SQLite
- Minimal Python Coding: Define new agents and tools through the database or API without writing new code
- Dynamic Loading: Automatically load tools and create agents from database records
- Agent Networks: Build complex multi-agent systems with different relationship types
- API Interfaces: REST API and CLI for managing agents, tools, and networks
- Import/Export: Export and import agents in JSON or YAML format for easy sharing and backup
- Extensible: Easily add new tools and agent types
# Clone the repository
git clone https://github.com/yourusername/db-adk.git
cd db-adk
# Install using uv
uv install -e .# Clone the repository
git clone https://github.com/yourusername/db-adk.git
cd db-adk
# Install the package
pip install -e .- Python 3.9+
- SQLite (built into Python)
- Google ADK (
google-adk)
Create a .env file with your ADK configuration:
# SQLite database path (default: db_adk.sqlite in the current directory)
DB_PATH=db_adk.sqlite
ADK_API_KEY=your_api_key
DEFAULT_MODEL=gemini-1.5-pro
# Initialize the database
db-adk db initYou can create agents and tools using the CLI, REST API, or by directly inserting records into the database.
Using the CLI:
# Create a tool
db-adk tools create \
--name "get_weather" \
--description "Get weather information for a location" \
--type "python_function" \
--module "my_tools.weather" \
--function "get_weather" \
--schema weather_schema.json
# Create an agent
db-adk agents create \
--name "weather_assistant" \
--description "Provides weather information" \
--type "LLM" \
--prompt "You are a weather assistant that provides weather information." \
--model "gemini-1.5-pro"
# Assign tool to agent
db-adk agent-tools assign --agent-id 1 --tool-id 1# Create input.json with the query
echo '{"query": "What is the weather in New York?"}' > input.json
# Run the agent
db-adk agents run 1 --input input.json# Start the server
db-adk serveDB-ADK supports exporting and importing agents in both JSON and YAML formats:
# Export an agent to JSON (default)
db-adk agents export 1 --output weather_agent.json
# Export an agent to YAML
db-adk agents export 1 --output weather_agent.yaml --format yaml
# Export all agents to a directory
db-adk agents export-all --output-dir agents_backup --format yaml
# Import an agent from file (format auto-detected)
db-adk agents import --file weather_agent.json
# Import all agents from a directory
db-adk agents import-dir --directory agents_backupDB-ADK consists of the following components:
- Database Layer: SQLAlchemy models and repositories for database interactions
- Core Layer: Dynamic agent and tool factories
- API Layer: REST API and CLI interfaces
- Import/Export: JSON and YAML import/export functionality
- Utils: Logging and schema validation utilities
The database schema includes the following tables:
agents: Agent definitions (configurations, prompts, descriptions)tools: Tool definitions (functions, parameters, descriptions)agent_tools: Mapping between agents and toolsagent_relationships: Relationships between agents (for multi-agent systems)
The package includes an example of a travel planning system with a coordinator agent and specialized agents for weather information and itinerary planning:
# Run the multi-agent network example
python -m db_adk.examples.multi_agent_networkThis example demonstrates:
- Creating a coordinator agent
- Creating specialized agents
- Assigning tools to agents
- Setting up relationships between agents
- Running a multi-agent network
/agents/: CRUD operations for agents/tools/: CRUD operations for tools/agent-tools/: Manage agent-tool mappings/agent-relationships/: Manage agent relationships/agents/{agent_id}/run: Run an agent/networks/{coordinator_id}/run: Run an agent network/agents/{agent_id}/export: Export an agent/agents/export-all: Export all agents/agents/import: Import an agent
db-adk db init: Initialize the databasedb-adk agents list: List all agentsdb-adk agents create: Create a new agentdb-adk agents run: Run an agentdb-adk agents export: Export an agent to JSON or YAMLdb-adk agents export-all: Export all agents to a directorydb-adk agents import: Import an agent from a filedb-adk agents import-dir: Import agents from a directorydb-adk tools list: List all toolsdb-adk tools create: Create a new tooldb-adk agent-tools assign: Assign a tool to an agentdb-adk agent-tools list: List agent-tool mappingsdb-adk relationships create: Create a relationship between agentsdb-adk networks run: Run an agent networkdb-adk serve: Start the REST API server
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.