AG Studio ships five agents: a Lead that coordinates, and specialists for Planning, Data, Page and Widget work.
Building a dashboard needs inspecting the data, planning a layout, placing widgets and then configuring each one, so the work is split across focused agents rather than given to a single prompt.
This page is the reference for what you get. To change any of it, see Agent Configuration.
Use Them As They Are Copy Link
The config builder hands you all five on builtIn, keyed by id, each a plain definition. Pair one with a runner to turn it into a running agent:
// Your AgLlmAdapter - see Direct LLM Runner.
const adapter = myOpenAiAdapter({ endpoint: '/api/llm' });
ai: ({ api }) =>
createAiHarness(api, ({ builtIn }) => ({
agents: Object.values(builtIn).map((definition) => directLlmRunner({ ...definition, adapter })),
primary: 'lead',
})),primary: 'lead' makes the lead the agent new threads start from. The other four are delegate-only and never appear in the user's agent picker.
To compose them with your own, spread and append:
createAiHarness(api, ({ builtIn, tools: { studio } }) => ({
agents: [
...Object.values(builtIn).map((definition) => directLlmRunner({ ...definition, adapter })),
directLlmRunner({
id: 'audit',
adapter,
description: 'Reviews a page for missing or misleading widgets.',
instructions: () => 'You review dashboards and report what is missing.',
tools: () => [studio.viewPage(), studio.viewWidget()],
}),
],
primary: 'lead',
}));import {
AgAiModel,
AgAiPromptStarter,
AgStudioAiModule,
AgStudioApi,
AgStudioModuleRegistry,
AgStudioProperties,
createAiHarness,
createStudio,
enableStudioDevValidations,
} from "ag-studio";
import { getGhcnCitiesData } from "./shared/ghcnCities/data.ts";
import { ghcnCitiesReportState } from "./shared/ghcnCities/state.ts";
import { openaiAdapter } from "./shared/openaiAdapter.ts";
if (process.env.NODE_ENV !== "production") {
// Enable extended validations only for development
enableStudioDevValidations();
}
export const AI_API_URL = "https://ai-api.ag-grid.com/api/openai/v1";
export const AI_API_TOKEN = "";
AgStudioModuleRegistry.registerModules([AgStudioAiModule]);
const adapter = openaiAdapter({
endpoint: AI_API_URL,
key: AI_API_TOKEN,
});
/**
* The suggestions a new conversation opens on. Each is worded to need more than one of the
* built-in agents, so the lead's delegation shows in the panel.
*/
const PROMPT_STARTERS: AgAiPromptStarter[] = [
{
label: "Add a rainfall page",
prompt:
"Add a page charting total rainfall by city and wet days by climate band.",
},
{
label: "Chart the hottest cities",
prompt: "Add a bar chart of the ten cities with the most hot days.",
},
{
label: "Explain this page",
prompt:
"Summarise what this page shows and which fields each widget reads.",
},
];
/**
* The models offered beside the send button. Each `id` reaches the adapter as declared here and is
* passed straight on to the provider, so these are real model ids. The first is the one a new
* conversation starts on.
*/
const MODELS: AgAiModel[] = [
{ id: "gpt-5.6-terra", label: "GPT-5.6 Terra" },
{ id: "gpt-5.6-sol", label: "GPT-5.6 Sol" },
{ id: "gpt-5.6-luna", label: "GPT-5.6 Luna" },
];
const studioProperties: AgStudioProperties = {
data: getGhcnCitiesData("https://www.ag-grid.com/studio/example-assets"),
mode: "edit",
initialState: ghcnCitiesReportState,
// Full local harness: AG's built-in agents (Lead → Data/Widget/Page/Planning) run through the
// real harness, and a telemetry observer folds the run/turn/tool event stream into OTLP spans.
ai: ({ api }) =>
createAiHarness(api, {
adapter,
promptStarters: PROMPT_STARTERS,
models: MODELS,
}),
};
let studioApi: AgStudioApi;
function setPage(pageId: string) {
studioApi?.setState({ ...studioApi.getState(), selectedPageId: pageId });
}
const studioDiv = document.querySelector<HTMLElement>("#myStudio")!;
studioApi = createStudio(studioDiv, studioProperties);
(window as any).setPage = setPage;
if (typeof window !== "undefined") {
// Attach external event handlers to window so they can be called from index.html
(<any>window).setPage = setPage;
}
The Team Copy Link
| Agent | Role | Tools | Delegates to |
|---|---|---|---|
| Lead | Coordinator. Reads the request, decides the approach, delegates. | view_schema, view_report, view_page, view_plan, update_plan, clear_plan, rename_thread, delegate_to | data, page, planning, widget |
| Planning | Turns a request into a structured plan. | view_schema, view_report, view_page, view_plan, create_plan | - |
| Data | Explores and queries the data; answers data questions. | execute_query, view_schema, create_expression, update_expression, delete_expression | - |
| Page | Places and moves widgets, manages page-level filters. | view_schema, view_page, view_plan, add_widget, position_widget, remove_widget, add_page_filter, remove_page_filter | - |
| Widget | Configures one widget: type, data mapping, titles, formatting. | view_schema, view_plan, view_widget, configure_widget, add_widget_filter, remove_widget_filter | - |
The Widget agent is parameterised. The lead names the widget's type and id when delegating, which narrows configure_widget's schema to that widget type's options, so its tools are resolved from delegation parameters rather than fixed.
For what each tool does, see Built-in Tools.
How a Dashboard Gets Built Copy Link
A worked delegation, for "build me a dashboard":
- Lead reads the message, calls
view_schemato see what data exists, and decides the request warrants a plan. - Lead delegates to Planning, which calls
create_planto produce a layout tree plus a widget entry per intended widget, then returns. - Lead delegates to Page, which calls
add_widgetfor each entry andposition_widgetto arrange them, returning the widget ids. - Lead delegates to a Widget agent per widget - these run concurrently - each calling
configure_widgetfor its own widget. - Lead marks the plan complete and summarises for the user.
The plan is a durable artefact on the thread, so a later message can pick up where the last one left off. The panel renders each delegation inline and expandable, so a user can follow the specialists' work.
Instructions Copy Link
Each built-in agent carries its own instructions, resolved per run. The data agent's include a generated description of your schema, so it starts knowing which tables and fields exist. The widget agent's include guidance on choosing a chart type. You can replace any of them - see Agent Configuration.
Next Copy Link
- Built-in Tools - what each tool does
- Agent Configuration - changing instructions, tools or the team
- Agent Overview - the contract underneath