Agent Framework
DB-GPT provides a data-driven multi-agent framework for building autonomous AI agents that can collaborate, use tools, access databases, and maintain memory across conversations.
Agent architectureâ
Every agent in DB-GPT is built around five core modules:
| Module | Purpose |
|---|---|
| Profile | Defines the agent's role, name, goal, and constraints |
| Memory | Stores conversation history and learned information |
| Planning | Decomposes complex tasks into executable steps |
| Action | Executes tools, queries, and other operations |
| Resource | Provides access to tools, databases, knowledge bases |
Key conceptsâ
ConversableAgentâ
The base class for all agents. It implements the conversation loop: receive message, think (plan), act, respond.
Multi-agent collaborationâ
Multiple agents can work together on complex tasks:
- Sequential â Agents pass results to each other in order
- Parallel â Multiple agents work on sub-tasks simultaneously
- Manager-Worker â A planning agent delegates to specialist agents
Memory typesâ
| Memory Type | Scope | Persistence |
|---|---|---|
| Sensory | Current message | None |
| Short-term | Current conversation | Session |
| Long-term | Across conversations | Database |
| Hybrid | Combines all three | Mixed |
Built-in agent typesâ
DB-GPT includes several pre-built agents:
- Data Analysis Agent â Analyzes data, generates SQL, creates charts
- Summary Agent â Summarizes long documents and conversations
- Code Agent â Generates and executes code
- Chat Agent â General-purpose conversational agent
Quick exampleâ
from dbgpt.agent import ConversableAgent, AgentContext
# Define a simple custom agent
agent = ConversableAgent(
name="DataAnalyst",
role="You are a data analysis expert",
goal="Help users analyze data and generate insights",
llm_config={"model": "chatgpt_proxyllm"},
)
# Start a conversation
result = await agent.a_send("Analyze the sales trends for Q4 2024")
What's nextâ
- Agent Introduction â Detailed agent framework guide
- Custom Agents â Build your own agents
- Agent Tools â Connect agents to tools
- Agent Planning â Task decomposition strategies