Agent Development Guide

Introduction #

In SmartChart, an Agent is a special type of dataset (dsType = 'agent') that wraps LLM calls into a dataset interface. Agent datasets can be used in charts just like regular datasets, seamlessly combining AI with visualization.

Creating an Agent Dataset #

Prerequisites #

  1. Ensure the smtgpt LLM data source is configured
  2. Navigate to the dataset management page

Creation Steps #

  1. Create Dataset: Click “New Dataset” and select the smtgpt data source
  2. Set Type: Set the dataset type to “Agent” (agent)
  3. Write Prompt: Fill in the agent’s system prompt in the SQL editor area to define the agent’s role and behavior rules
  4. Write User Prompt: Define user interaction templates in the notes or parameters
  5. Publish: Save and publish the dataset, then it can be used in charts and conversations

Agent Type Comparison #

Type dsType Purpose Example
Dataset ds Standard SQL query dataset Sales data query
Agent agent Wrap LLM calls Data analysis assistant, customer service bot
Tool tool Reusable tool function Data cleaning, format conversion
Chart chart Reusable chart component Pre-configured chart template
API api External API call HTTP interface proxy

Agent Dataset Configuration Example #

// Dataset name: Data Analysis Assistant
// Data source: smtgpt
// dsType: agent
// sql_str (System Prompt):
You are a professional data analyst, skilled at discovering business insights from data.
Please reply to user questions in concise language, keeping each response under 200 words.
If the user provides data, first summarize the data characteristics, then give analysis conclusions.

Using Agents in Charts #

In the chart development interface, select an agent-type dataset as the data source. The system will call the LLM and render the returned result in the chart.

Using Agents in Conversations #

Enter / in the homepage chat input, select the agent dataset you created, and the conversation will automatically use the agent’s role settings for interaction.