Skip to main content
Version: dev

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:

ModulePurpose
ProfileDefines the agent's role, name, goal, and constraints
MemoryStores conversation history and learned information
PlanningDecomposes complex tasks into executable steps
ActionExecutes tools, queries, and other operations
ResourceProvides 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 TypeScopePersistence
SensoryCurrent messageNone
Short-termCurrent conversationSession
Long-termAcross conversationsDatabase
HybridCombines all threeMixed

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​