> ## Documentation Index
> Fetch the complete documentation index at: https://docs.circuit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Building a temperature calculator

> Step-by-step example of creating an agent action that converts Fahrenheit to Celsius using an input form and a prompt template.

This tutorial walks through creating an action that converts a temperature from Fahrenheit to Celsius at the click of a button. It's a simple example, but it demonstrates the pattern for building any kind of calculator or structured tool with agent actions.

## What we're building

A single-button action that:

1. Asks the user for a temperature in Fahrenheit
2. Converts it to Celsius
3. Returns the result

## Create the action

<Steps>
  <Step title="Open the agent's Actions tab">
    Navigate to the agent you want to add the calculator to and open its configuration. Go to the **Actions** tab and click **Add action**.

    Choose **Form template** as the action type.
  </Step>

  <Step title="Set the basics">
    Configure the action's identity:

    * **Title**: Temperature Converter
    * **Description**: Convert a temperature from Fahrenheit to Celsius
    * **Icon**: `thermometer`
  </Step>

  <Step title="Add the input field">
    Add a single form field:

    * **Label**: Temperature (°F)
    * **Name**: `temperature_f`
    * **Type**: number
    * **Required**: yes
    * **Placeholder**: e.g. 72
  </Step>

  <Step title="Write the prompt template">
    Set the prompt template to:

    ```
    Convert {{temperature_f}} degrees Fahrenheit to Celsius.
    Show the result rounded to one decimal place.
    Respond with just the conversion, for example: "72°F = 22.2°C"
    ```

    The `{{temperature_f}}` placeholder gets replaced with whatever the user types into the form.
  </Step>

  <Step title="Save and test">
    Save the action. It now appears as a button in the agent's interface. Click it, enter a temperature, and verify the result.
  </Step>
</Steps>

## How it works

When a user clicks the **Temperature Converter** button and enters a value, Circuit substitutes the value into the prompt template and sends it to the agent as a chat message. The agent processes it like any other question — but because the prompt is structured and specific, the output is consistent every time.

## Taking it further

This same pattern works for any calculation or structured task:

* **Unit conversions** — add a select field for source and target units to build a general-purpose converter
* **Quoting calculators** — collect dimensions, material type, and quantity, then prompt the agent to compute a price using reference data from its indexes
* **Checklists** — use checkbox fields to capture inputs and generate a formatted report

See [creating agent actions](/university/agent-actions/creating-actions) for the full reference on form fields, validation, and follow-up actions.
