LLM Actions
Overview
LLM Actions in Agent Studio provide built-in capabilities to leverage large language model (LLM) functionalities directly within your Compound Actions and Conversational Processes. These actions enable tasks such as summarization, reasoning, classification, data extraction, and content generation, allowing you to build workflows without custom integrations.
This documentation focuses on two key LLM Actions: generate_text_action and generate_structured_value_action. These actions are designed to help you process unstructured data, generate insights, and structure outputs efficiently.
Security note
When you enable web search or file input, the model consumes untrusted content that may contain prompt-injection attacks. Before building flows that combine private data, untrusted content, and the ability to send data externally, read Security: the lethal trifecta.
generate_text_action
Description
The generate_text_action invokes an LLM to produce free-form text output based on user-provided input. This action is ideal for tasks requiring natural language generation, such as summarizing documents, generating responses, or performing step-by-step reasoning.
Use this action when you need unstructured text results, like drafting emails, explaining concepts, or brainstorming ideas.
Input Parameters
Combining and listing image & file inputs
image and file can be provided in the same request, and either parameter can accept multiple files. To pass multiple files, supply a list of File objects — either from a single List[File] slot, or assembled from separate File slots:
Output
If the model refuses the request or the generation is incomplete, generated_output may be returned as null.
Usage Examples
Here are practical examples demonstrating various LLM abilities. Each includes a sample request schema for integration into a Compound Action.
Example 1: Text Summarization
Summarize a lengthy article or user query into a concise overview.
Example 2: Content Generation
Generate creative or instructional content, such as drafting a user email.
Example 3: Step-by-Step Reasoning
Guide the LLM through logical reasoning for problem-solving.
Example 4: Image OCR
Extract text from an uploaded image, such as a receipt. The image parameter maps to a File object collected via a File Slot.
Example 5: Document Q&A
Answer a question against an uploaded document, such as a PDF policy. The file parameter maps to a File object collected via a File Slot.
Example 6: Comparing Multiple Documents
Pass more than one file in a single call by mapping the file parameter to a list of File objects. This requires a List[File] slot so the user can attach multiple documents.
generate_structured_value_action
Description
The generate_structured_value_action calls an LLM to extract or generate data in a predefined structured format (JSON schema). This is particularly useful for classification, entity extraction, or transforming unstructured input into queryable data.
Apply this action for tasks where output consistency is critical, such as tagging content, extracting key-value pairs, or categorizing user inputs.
Input Parameters
️ additionalProperties: false must always be set in objects.
additionalProperties controls whether it is allowable for an object to contain additional keys / values that were not defined in the JSON Schema.
Output
If the model refuses the request or the generation is incomplete, generated_output may be returned as null.
Usage Examples
Examples illustrate extraction, classification, and more. Include request schemas for easy implementation.
Example 1: Topic Classification (Existing Example, Expanded)
Classify a research abstract into predefined topics.
Expected Output
Example 2: Entity Extraction
Extract named entities like names, dates, and locations from text.
Expected Output
Example 3: Sentiment Classification
Classify text sentiment with confidence scores.
Expected Output
Example 4: Structured Extraction from an Image
Extract structured fields from an uploaded image, such as a receipt. The image parameter maps to a File object collected via a File Slot.
Expected Output
Example 5: Structured Extraction from a Document
Extract structured fields from an uploaded document, such as a PDF invoice. The file parameter maps to a File object collected via a File Slot.
Expected Output
Model Reference
Live Search
Live Search is enabled per call with the enable_web_search argument. It is available on all models except gpt-5 models with reasoning_effort set to minimal.
Image Input Limitations
Images must be supplied as a File object via a File Slot, which enforces a maximum file size of 5MB — files exceeding this limit will fail to upload. Supported image formats: PNG, JPEG/JPG, WEBP, and non-animated GIF. For best results, we recommend using gpt-5 or newer.
File Input Limitations
Files must be supplied as a File object via a File Slot, which enforces a maximum file size of 5MB — files exceeding this limit will fail to upload.
The combined size of all images and files in a single action call must stay under ~11 MB of raw file content (16 MiB encoded, enforced by the platform). As a rule of thumb, keep individual files under ~5 MB and prefer fewer, smaller attachments.
For PDFs, both the text and page images are extracted by vision-capable models such as gpt-4o and later. For non-PDF documents, only the extracted text is passed to the model — embedded charts and images are not included. Note that large PDFs also consume model context — every page contributes both text and image tokens — so very long documents may exceed the model’s context window even when they fit the size limit. For best results, we recommend using gpt-5 or newer.
Supported file types
The file parameter accepts the following file types:
Security: the lethal trifecta
Features like web search and file input make LLM Actions far more powerful, but they also expand what an attacker can attempt through prompt injection — malicious instructions hidden inside content the model reads (a web page returned by search, an uploaded PDF, a spreadsheet cell, or an API response). Because a large language model cannot reliably tell the difference between the instructions you wrote and instructions embedded in the data it is processing, any untrusted content should be treated as potentially adversarial.
The lethal trifecta (a term coined by security researcher Simon Willison) describes the specific combination of capabilities that turns prompt injection from a nuisance into a data-exfiltration risk. The danger arises when a single flow has all three of the following at once:
- Access to private data — sensitive input such as a user’s records, internal documents, or data pulled from connected systems into
payload/user_input. - Exposure to untrusted content — anything the model reads that you don’t fully control, including
enable_web_searchresults, uploadedfileandimageinputs, and responses from external APIs. - The ability to communicate externally — a way to send data out of the environment, such as a subsequent HTTP action, an outbound notification, or even a URL the model can cause to be fetched.
When all three are present, injected instructions in the untrusted content can direct the model to take the private data and exfiltrate it through the outbound channel — without the user ever seeing it happen.
Avoid combining all three capabilities in one flow
The most reliable mitigation is to break the trifecta: design your Compound Actions and Conversational Processes so that a flow handling private data and untrusted content does not also have an unrestricted way to send data externally.
Additional safeguards:
- Treat file, image, and web content as untrusted. Never feed model output derived from untrusted content directly into a downstream action that transmits data (HTTP calls, notifications, or dynamically constructed URLs).
- Scope web search. Use
web_search_allowed_domainsto restrict searches to sources you trust, orweb_search_blocked_domainsto exclude risky ones. - Constrain outputs. Prefer
generate_structured_value_actionwith a strictoutput_schemaso the model can only return the specific fields you expect, rather than free-form text or arbitrary URLs. - Keep a human in the loop for any action that sends sensitive data outside the environment.