# Show a widget

> Gives an agent a table, card, form or chart it shows in a conversation, laid out the same way every time.

Building an agent goes in order: build the agent, connect your systems, add functions, scripts and widgets, test it, take it live, then put it in your product. Highlighted: Add functions, scripts and widgets.

## Ask your coding agent

```
Build a widget for the invoice exceptions agent: a table of invoice lines against purchase order lines, with quantity, unit price and total for each, and the lines that differ marked. Publish it and add it to the agent.
```

## What gets built

A [widget](https://docs.mindset.ai/docs/widgets) with parameters the agent fills in. On the agent it becomes a tool, and its parameters are the tool's arguments. Mindset checks the agent's data against them and refuses the wrong shape with the reason, never quietly changing it. A button in a widget can send an action back to the agent, which starts its next turn.

Every agent can already draw simple charts and tables without one, and the numbers in those come from the model. Build a widget when you want the same layout every time, filled from parameters the agent must get right.

## What you decide

- **Its parameters.** Each has a name, a type (**Text**, **Number**, **Yes or no**, **List** or **Object**) and a description that tells the agent exactly what to supply.
- **Which script phases offer it.** A phase that lists its resources offers the widget only if it's listed.

> **Warning:** Activating an earlier agent version doesn't bring back an earlier version of a widget. Use **Re-activate** on the widget's **Versions** tab.

## Done when

- It's published, and an active agent version holds it.
- You saw the agent show it on the **Chat** tab, filled with real data.
- You know which version you'd **Re-activate** if a change goes wrong.

## See it working

**Live demo:** [Widget round trip](https://docs.mindset.ai/demos/kettle). The agent offers a grind picker in the chat, and your tap changes the coffee page in reply.

## In your repo

Each widget is a file in the agent's `widgets/` folder, holding the exact input `create_resource` takes. See [Keep your agents in your code](https://docs.mindset.ai/docs/keep-your-agents-in-your-code).

## In the Studio

**Widgets → + New widget** opens the **Widget Builder**. Describe the widget, press **Open widget →**, and refine it on **Preview**. Set its parameters on **Data**, press **Save changes**, and publish it on **Versions**. Then add it in the **Widgets** card on the agent's **Resources** tab.

![A widget's Preview tab, showing the invoice review card.](https://docs.mindset.ai/images/docs/studio/widget-preview.png)
