# Testing & Debugging Basics

{% embed url="<https://youtu.be/UEv1B9w7Z3k>" %}

This guide introduces key tools and practices for testing and debugging your AI agents as you build them in MindStudio. You’ll also learn how to identify and fix common errors like variable mismatches, high temperature settings, and missing prompts.

## Checking the Errors Tab

The first step when building any agent is to check the **Errors** tab. This will surface:

* Misconfigured blocks
* Referenced variables that don’t exist
* Missing required fields

If the tab shows **no errors or warnings**, proceed to running your agent using the debugger.

## Using the Debugger

The **Debugger** tracks every step in your agent’s run:

1. Click **Preview**, then choose **Run in Debugger** or open a **Draft Agent**.
2. If your agent includes user input, it will prompt you for a value (e.g., topic = “dogs”).
3. The debugger will log:
   * Each block’s execution
   * Variable values at each step
   * Inputs and outputs
   * Total runtime and cost

This lets you verify whether the variables are passed correctly and prompts are resolving as expected.

## Common Mistake 1: Forgetting to Use the Variable

If an agent runs but doesn’t include user input (e.g., the AI says, “Let me know what you want to write about”), you likely forgot to include the variable in your prompt.

**Fix:**

* Edit the **Generate Text** block.
* Use your variable with opening/closing tags:

  ```
  cssCopyEditWrite a blog post about the following topic:
  <topic>{{ topic }}</topic>
  ```

Re-run the agent and confirm the input is correctly inserted.

## Common Mistake 2: Typo in Variable Name

Another common error is referencing a variable that hasn’t been defined—usually due to a typo.

**Fix:**

* Check the Errors tab.
* Error will indicate something like: `Variable 'top' is referenced but does not exist`.
* Click the error to highlight the block.
* Correct the variable name to `topic`.

You can test the fix in the debugger using a **test value** set in the user input configuration.

## Common Mistake 3: High Temperature Output

If your AI outputs gibberish or chaotic text, it's likely caused by a **temperature setting that is too high**.

**Fix:**

* Go to **Model Settings** or directly edit the temperature in the Generate Text block.
* Lower the temperature to a mid-range value (recommended default).
* Rerun your test.

MindStudio displays a warning when a temperature setting is too high and may lead to unstable outputs.

## Common Mistake 4: Empty Generate Text Block

If the prompt field in a Generate Text block is empty, the Errors tab will show:

```
scssCopyEditMessage in generate text block cannot be empty
```

**Fix:**

* Click the error to highlight the block.
* Fill in a prompt like:

  ```
  cssCopyEditWrite a blog post about the following topic:
  <topic>{{ topic }}</topic>
  ```

## Tips for Efficient Debugging

* Use **test values** for user inputs when debugging without launching a draft.
* Use the **debugger expansion panel** to trace logic, outputs, and costs.
* Regularly check for spelling errors and missing prompt content.
* Always validate changes with a test run.

## Accessing Support and Community Resources

If you run into issues:

* Click **Help and Support** in the sidebar.
* Access:
  * Support forum
  * Video tutorials
  * Documentation
  * Quick help tabs

The MindStudio community is active and helpful—many common issues have already been discussed and resolved.

## Final Thoughts

Testing and debugging are essential steps in building reliable AI agents. By mastering these basics—especially using the Errors tab and debugger—you’ll streamline your development process and catch problems early.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://university.mindstudio.ai/1-core-building-principles/testing-and-debugging-basics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
