For the complete documentation index, see llms.txt. This page is also available as Markdown.

Database

What Is This?

Database enables Agents to query structured data using natural language. When a user asks "How many laptops did we sell last month?", the Agent automatically converts the question into a SQL query, retrieves the answer from the database, and responds in plain language.

The technical name for this feature is Text to SQL.

When Do You Need It?

When your use case involves:

  • Data queries: Order status, inventory quantities, sales figures

  • Statistical analysis: "How much did this quarter's revenue grow compared to last quarter?"

  • Real-time status: "How many pending tickets are there right now?"

The answers to these questions are stored in structured tables, not in documents, so you need a Database rather than a Knowledge Base.

What Databases Are Supported?

Type
Description

MaiAgent Built-in Database

A database provided by the platform where you can directly upload CSV files or manually create tables

External Database

Connect to your PostgreSQL, MySQL, SQL Server, or Oracle

Is It Secure?

The Agent only executes read-only queries (SELECT) and will not modify or delete your data. You can also restrict which tables and fields the Agent can access.

Advanced Note: The accuracy of Text to SQL depends on how clearly the table structure is defined. It is recommended to add Chinese descriptions to tables and fields to help the Agent understand what each field represents.

What Do I Need to Do?

  1. Create a database connection — Select the database type and configure connection details

  2. Set accessible tables — Choose which tables the Agent can query

  3. Add field descriptions — Add descriptions to fields to improve query accuracy

  4. Test queries — Test whether the Agent can query correctly using natural language

  5. Attach to Agent — Link to the Agent as a tool

Further Reading

Last updated

Was this helpful?