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

# LLM Query Action

> Run a direct LLM query without browser context

`misc_action.llm_query` sends a prompt directly to an LLM and stores the structured response—no browser state, axtree, or screenshot is involved.

## Overview

* **Use when**: You need to transform, classify, or reason over data already in memory (e.g., reformat an extracted date, classify extracted text, compute a derived value).
* **Execution**: The action sends `prompt_instructions` to the configured LLM, parses the response according to `output_format`, and stores results in `output_data`. Specified fields are optionally promoted to `generated_variables`.
* **No browser access**: Unlike `extraction_action.llm`, this action does not read the current page. Reference earlier extracted values via `{variable_name[index]}` in your prompt.

## Properties

| Property | Type | Default | Description |
| - | - | - | - |
| `output_format` | `dict` | Required | Expected output structure as a type-annotated dict |
| `prompt_instructions` | `str` | Required | The full prompt to send to the LLM |
| `output_variable_names` | `list[str] \| None` | `None` | Promote response fields to `generated_variables` |
| `llm_model_name` | `str \| None` | `None` | Vertex model ID, e.g. `"gemini-4-argon"`. Falls back to the task model, then `LLM_MODEL` |
| `llm_provider` | `str \| None` | `None` | Deprecated — prefix the provider in `llm_model_name` instead |

## JSON Example

```json theme={null}
{
  "type": "action_node",
  "misc_action": {
    "llm_query": {
      "output_format": {
        "category": "str",
        "confidence": "str"
      },
      "prompt_instructions": "Classify the following support ticket as 'billing', 'technical', or 'other'. Ticket: {ticket_text[0]}",
      "output_variable_names": ["category"]
    }
  }
}
```

## Output Format

Define the expected response structure with Python type hints:

```json theme={null}
{
  "output_format": {
    "summary": "str",
    "status": "str",
    "items": "List[str]"
  }
}
```

> [!NOTE]
>
> Only `str` and `List[str]` are supported types in `output_format`.

## Using Variables in Prompts

Reference extracted values from earlier nodes using `{variable_name[index]}`:

```json theme={null}
{
  "misc_action": {
    "llm_query": {
      "output_format": { "normalized_date": "str" },
      "prompt_instructions": "Reformat this date to ISO 8601 (YYYY-MM-DD): {raw_date[0]}",
      "output_variable_names": ["normalized_date"]
    }
  }
}
```

After this action, `{normalized_date[0]}` is available in subsequent nodes.

## Storing Output as Variables

Set `output_variable_names` to promote response fields into `generated_variables`:

```json theme={null}
{
  "misc_action": {
    "llm_query": {
      "output_format": {
        "next_url": "str",
        "has_more_pages": "str"
      },
      "prompt_instructions": "Given these pagination links: {page_links[0]}, return the next page URL and whether more pages exist ('true'/'false').",
      "output_variable_names": ["next_url", "has_more_pages"]
    }
  }
}
```

> [!WARNING]
>
> Every key in `output_variable_names` must appear in `output_format`. Validation fails at schema load time if a key is missing.

## Choosing a Model

Set `llm_model_name` to a Vertex model ID:

| Model | Notes |
| - | - |
| `gemini-3.5-flash-lite` | Default; cost-effective |
| `gemini-3.6-flash` | Stronger, still fast |
| `gemini-4-argon` | Harder reasoning over extracted data |
| `claude-sonnet-5-5` | Strong reasoning |

Omit `llm_model_name` to use the task model, which itself falls back to the `LLM_MODEL` environment variable. See [Model Configuration](https://docs.optexity.com/docs/advanced/model-configuration.md).

## LLM Query vs LLM Extraction

| | `misc_action.llm_query` | `extraction_action.llm` |
| - | - | - |
| Browser context | None — prompt only | axtree and/or screenshot of current page |
| Typical use | Transform / classify in-memory data | Extract data from the page the browser is on |
| Input source | Variables embedded in the prompt | Live page content |
| Output destination | `output_data` + optional `generated_variables` | `output_data` + optional `generated_variables` |

> [!TIP]
>
> Use `misc_action.llm_query` after an extraction step to post-process or validate extracted data without consuming a browser round-trip.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.