LLM Actions

View as MarkdownOpen in Claude

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.

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

FieldTypeRequiredDescription
system_promptstringDefines the model’s behavior or instructions. For example, “Act as a helpful assistant that summarizes technical articles.”
user_inputstringThe primary context or query for the LLM to process.
modelstringSpecifies the LLM model to use. See the Model Reference for available options. Defaults to gpt-4o-mini-2024-07-18
temperaturenumberControl the randomness of the output. Higher values will make the output more random, while lower values will make it more focused and deterministic
reasoning_effortstringOptional reasoning effort argument. Can be set to one of “minimal” (only gpt-5 models), "low", "medium", or "high". Must be left empty for non-reasoning models such as gpt-4.1.

Output

FieldTypeDescription
generated_outputstringThe LLM-generated text response.

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.

YAML - Compound Action
1- action:
2 action_name: mw.generate_text_action
3 input_args:
4 system_prompt: '''Summarize the following text in 3-5 bullet points, focusing on key takeaways.'''
5 user_input: data.article_content # e.g., a long blog post fetched from an API
6 model: '''gpt-4o-mini'''
7 temperature: 0.7
8 output_key: summary_output
Conversational Process
1system_prompt: '''Summarize the following text in 3-5 bullet points, focusing on key takeaways.'''
2user_input: data.article_content # e.g., a long blog post fetched from an API
3model: '''gpt-4o-mini'''
4temperature: 0.7

Example 2: Content Generation

Generate creative or instructional content, such as drafting a user email.

YAML - Compound Action
1- action:
2 action_name: mw.generate_text_action
3 input_args:
4 system_prompt: '''Write a professional email response based on the user's complaint.'''
5 user_input: data.user_complaint # e.g., "My order is delayed by two weeks."
6 output_key: email_draft
Conversational Process
1system_prompt: '''Write a professional email response based on the user's complaint.'''
2user_input: data.user_complaint # e.g., "My order is delayed by two weeks."

Example 3: Step-by-Step Reasoning

Guide the LLM through logical reasoning for problem-solving.

YAML - Compound Action
1- action:
2 action_name: mw.generate_text_action
3 input_args:
4 system_prompt: '''Solve the problem step by step, explaining your reasoning.'''
5 user_input: '''What is the next number in the sequence: 2, 4, 8, 16?'''
6 reasoning_effort: '''high'''
7 model: '''gpt-5-2025-08-07'''
8 output_key: reasoning_output
Conversational Process
1system_prompt: '''Solve the problem step by step, explaining your reasoning.'''
2user_input: '''What is the next number in the sequence: 2, 4, 8, 16?'''
3reasoning_effort: '''high'''
4model: '''gpt-5-2025-08-07'''

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

FieldTypeRequiredDescription
payloadobjectThe data or text to analyze.
output_schemaobjectJSON Schema defining the expected output structure.
system_promptstringDefines the model’s behavior or instructions. For example, “Act as a helpful assistant that summarizes technical articles.”
modelstringSpecifies the LLM model to use. Defaults to "gpt-4o-mini-2024-07-18". IMPORTANT: This action is only compatible with gpt-4o-mini-2024-07-18 and later and gpt-4o-2024-08-06 and later.
strictstringEnforces schema adherence. Defaults to false; Can either be trueor false
output_schema_namestringLLM-facing name for the schema (defaults to extracted_value)
output_schema_descriptionstringDescription of the schema for the LLM.
reasoning_effortstringOptional reasoning effort argument. Can be set to one of “minimal” (only gpt-5 models), "low", "medium", or "high". Must be left empty for non-reasoning models such as gpt-4.1.

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

FieldTypeDescription
generated_outputobjectStructured data matching the provided schema.

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.

YAML - Compound Action
1- action:
2 action_name: mw.generate_structured_value_action
3 input_args:
4 payload: data.research_paper_abstract
5 system_prompt: '''Given a research paper abstract and a list of topic options, output up to 5 topics that accurately apply to the paper.'''
6 output_schema: >-
7 {
8 "type": "object",
9 "properties": {
10 "topic_tags": {
11 "type": "array",
12 "items": {
13 "type": "string",
14 "enum": data.topic_tag_options # e.g., ["AI", "ML", "NLP"]
15 }
16 }
17 },
18 "required": ["topic_tags"],
19 "additionalProperties": false
20 }
21 strict: true
22 output_key: classified_topics
Conversational Process
1payload: data.research_paper_abstract
2system_prompt: '''Given a research paper abstract and a list of topic options, output up to 5 topics that accurately apply to the paper.'''
3output_schema: >-
4 {
5 "type": "object",
6 "properties": {
7 "topic_tags": {
8 "type": "array",
9 "items": {
10 "type": "string",
11 "enum": data.topic_tag_options # e.g., ["AI", "ML", "NLP"]
12 }
13 }
14 },
15 "required": ["topic_tags"],
16 "additionalProperties": false
17 }
18strict: true
Expected Output
1generated_output: {
2 "topic_tags": ["LLM Capabilities", "Reinforcement Learning (RL)", "Reasoning"]
3}

Example 2: Entity Extraction

Extract named entities like names, dates, and locations from text.

YAML - Compound Action
1- action:
2 action_name: mw.generate_structured_value_action
3 input_args:
4 payload: data.user_message # e.g., "John Doe will arrive in New York on October 15, 2025."
5 system_prompt: '''Extract entities such as persons, locations, and dates from the text.'''
6 output_schema: >-
7 {
8 "type": "object",
9 "properties": {
10 "persons": {"type": "array", "items": {"type": "string"}},
11 "locations": {"type": "array", "items": {"type": "string"}},
12 "dates": {"type": "array", "items": {"type": "string"}}
13 },
14 "required": ["persons", "locations", "dates"],
15 "additionalProperties": false
16 }
17 reasoning_effort: '''low'''
18 model: '''gpt-5-2025-08-07'''
19 output_key: extracted_entities
Conversational Process
1payload: data.user_message # e.g., "John Doe will arrive in New York on October 15, 2025."
2system_prompt: '''Extract entities such as persons, locations, and dates from the text.'''
3output_schema: >-
4 {
5 "type": "object",
6 "properties": {
7 "persons": {"type": "array", "items": {"type": "string"}},
8 "locations": {"type": "array", "items": {"type": "string"}},
9 "dates": {"type": "array", "items": {"type": "string"}}
10 },
11 "required": ["persons", "locations", "dates"],
12 "additionalProperties": false
13 }
14reasoning_effort: '''low'''
15model: '''gpt-5-2025-08-07'''
Expected Output
1generated_output: {
2 "persons": ["John Doe"],
3 "locations": ["New York"],
4 "dates": ["October 15, 2025"]
5}

Example 3: Sentiment Classification

Classify text sentiment with confidence scores.

YAML - Compound Action
1- action:
2 action_name: mw.generate_structured_value_action
3 input_args:
4 payload: data.customer_review
5 system_prompt: '''Analyze the sentiment of the review and output the category with a confidence score.'''
6 output_schema: >-
7 {
8 "type": "object",
9 "properties": {
10 "sentiment": {
11 "type": "string",
12 "enum": ["positive", "negative", "neutral"]
13 },
14 "confidence": {"type": "number"}
15 },
16 "required": ["sentiment", "confidence"],
17 "additionalProperties": false
18 }
19 output_key: sentiment_analysis
Conversational Process
1payload: data.customer_review
2system_prompt: '''Analyze the sentiment of the review and output the category with a confidence score.'''
3output_schema: >-
4 {
5 "type": "object",
6 "properties": {
7 "sentiment": {
8 "type": "string",
9 "enum": ["positive", "negative", "neutral"]
10 },
11 "confidence": {"type": "number"}
12 },
13 "required": ["sentiment", "confidence"],
14 "additionalProperties": false
15 }
Expected Output
1generated_output: {
2 "sentiment": "positive",
3 "confidence": 0.85
4}

Model Reference

ModelCapabilitiesOpenAI DirectAzure OpenAI
ContextMax OutputReasoning EffortLive SearchUSEUUSEUCAAUGov
gpt-5.2-2025-12-11400K128K
gpt-5.2400K128K
gpt-5.1-2025-11-13400K128K
gpt-5.1-chat-latest400K128K
gpt-5.1400K128K
gpt-5-2025-08-07400K128K
gpt-5400K128K
gpt-5-mini-2025-08-07400K128K
gpt-5-mini400K128K
gpt-5-nano-2025-08-07400K128K
gpt-5-nano400K128K
o4-mini-2025-04-16200K100K
o4-mini1M100K
gpt-4.1-2025-04-141M32K
gpt-4.11M32K
gpt-4.1-mini-2025-04-141M32K
gpt-4.1-mini1M32K
gpt-4.1-nano-2025-04-141M32K
gpt-4.1-nano1M32K
o3-2025-04-16200K100K
o3200K100K
o3-mini-2025-01-31200K100K
o3-mini200K100K
o1-2024-12-17200K100K
o1200K100K
gpt-4o-2024-11-20128K16K
gpt-4o128K16K
gpt-4o-mini-2024-07-18128K16K
gpt-4o-mini128K16K
gpt-4o-search-preview128K16K