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.

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.

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

Example 2: Content Generation

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

- action:
    action_name: mw.generate_text_action
    input_args:
      system_prompt: '''Write a professional email response based on the user's complaint.'''
      user_input: data.user_complaint  # e.g., "My order is delayed by two weeks."
    output_key: email_draft
system_prompt: '''Write a professional email response based on the user's complaint.'''
user_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.

- action:
    action_name: mw.generate_text_action
    input_args:
      system_prompt: '''Solve the problem step by step, explaining your reasoning.'''
      user_input: '''What is the next number in the sequence: 2, 4, 8, 16?'''
      reasoning_effort: '''high'''	
			model: '''gpt-5-2025-08-07'''
    output_key: reasoning_output
system_prompt: '''Solve the problem step by step, explaining your reasoning.'''
user_input: '''What is the next number in the sequence: 2, 4, 8, 16?'''
reasoning_effort: '''high'''	
model: '''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.
user_inputstringThe primary context or query for the LLM to process.
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.
strictbooleanEnforces schema adherence. Defaults to 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.

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.

- action:
    action_name: mw.generate_structured_value_action
    input_args:
      payload: data.research_paper_abstract
      system_prompt: '''Given a research paper abstract and a list of topic options, output up to 5 topics that accurately apply to the paper.'''
      output_schema: >-
        {
            "type": "object",
            "properties": {
                "topic_tags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": data.topic_tag_options  # e.g., ["AI", "ML", "NLP"]
                    }
                }
            },
            "required": ["topic_tags"],
            "additionalProperties": false
        }
      strict: true
    output_key: classified_topics
payload: data.research_paper_abstract
system_prompt: '''Given a research paper abstract and a list of topic options, output up to 5 topics that accurately apply to the paper.'''
output_schema: >-
    {
        "type": "object",
        "properties": {
            "topic_tags": {
                "type": "array",
                "items": {
                    "type": "string",
                    "enum": data.topic_tag_options  # e.g., ["AI", "ML", "NLP"]
                }
            }
        },
        "required": ["topic_tags"],
        "additionalProperties": false
    }
strict: true
Expected Output
generated_output: {
  "topic_tags": ["LLM Capabilities", "Reinforcement Learning (RL)", "Reasoning"]
}

Example 2: Entity Extraction

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

- action:
    action_name: mw.generate_structured_value_action
    input_args:
      payload: data.user_message  # e.g., "John Doe will arrive in New York on October 15, 2025."
      system_prompt: '''Extract entities such as persons, locations, and dates from the text.'''
      output_schema: >-
        {
            "type": "object",
            "properties": {
                "persons": {"type": "array", "items": {"type": "string"}},
                "locations": {"type": "array", "items": {"type": "string"}},
                "dates": {"type": "array", "items": {"type": "string"}}
            },
            "required": ["persons", "locations", "dates"],
            "additionalProperties": false
        }
      reasoning_effort: '''low'''
			model: '''gpt-5-2025-08-07'''
    output_key: extracted_entities
payload: data.user_message  # e.g., "John Doe will arrive in New York on October 15, 2025."
system_prompt: '''Extract entities such as persons, locations, and dates from the text.'''
output_schema: >-
    {
        "type": "object",
        "properties": {
            "persons": {"type": "array", "items": {"type": "string"}},
            "locations": {"type": "array", "items": {"type": "string"}},
            "dates": {"type": "array", "items": {"type": "string"}}
        },
        "required": ["persons", "locations", "dates"],
        "additionalProperties": false
    }
reasoning_effort: '''low'''
model: '''gpt-5-2025-08-07'''
Expected Output
generated_output: {
  "persons": ["John Doe"],
  "locations": ["New York"],
  "dates": ["October 15, 2025"]
}

Example 3: Sentiment Classification

Classify text sentiment with confidence scores.

- action:
    action_name: mw.generate_structured_value_action
    input_args:
      payload: data.customer_review
      system_prompt: '''Analyze the sentiment of the review and output the category with a confidence score.'''
      output_schema: >-
        {
            "type": "object",
            "properties": {
                "sentiment": {
                    "type": "string",
                    "enum": ["positive", "negative", "neutral"]
                },
                "confidence": {"type": "number"}
            },
            "required": ["sentiment", "confidence"],
            "additionalProperties": false
        }
    output_key: sentiment_analysis
payload: data.customer_review
system_prompt: '''Analyze the sentiment of the review and output the category with a confidence score.'''
output_schema: >-
    {
        "type": "object",
        "properties": {
            "sentiment": {
                "type": "string",
                "enum": ["positive", "negative", "neutral"]
            },
            "confidence": {"type": "number"}
        },
        "required": ["sentiment", "confidence"],
        "additionalProperties": false
    }
Expected Output
generated_output: {
  "sentiment": "positive",
  "confidence": 0.85
}

Model Reference

ModelContext WindowMax OutputReasoning Effort CompatibleBest ForAvailabilityLive web search capable
gpt-5-2025-08-07400k tokens128k tokensAdvanced multi-modal reasoning and long-form content creationOpenAI direct only. Not available to Azure OpenAI.
gpt-5400k tokens128k tokensComplex problem-solving with large datasetsOpenAI direct only. Not available to Azure OpenAI.
gpt-5-mini-2025-08-07400k tokens128k tokensEfficient long-context analysis and summarizationOpenAI direct only. Not available to Azure OpenAI.
gpt-5-mini400k tokens128k tokensQuick prototyping of AI agents with extended memoryOpenAI direct only. Not available to Azure OpenAI.
gpt-5-nano-2025-08-07400k tokens128k tokensProcessing of lengthy documentsOpenAI direct only. Not available to Azure OpenAI.
gpt-5-nano400k tokens128k tokensProcessing of lengthy documentsOpenAI direct only. Not available to Azure OpenAI.
o4-mini-2025-04-16200k tokens100k tokensStep-by-step reasoning for technical documentationOpenAI direct only. Not available to Azure OpenAI.
o4-mini200k tokens100k tokensOptimized chain-of-thought for research tasksOpenAI direct only. Not available to Azure OpenAI.
gpt-4.1-2025-04-141M tokens32k tokensUltra-long document processing and archival analysisAvailable to all commercial orgs.
gpt-4.11M tokens32k tokensUltra-long document processing and archival analysisOpenAI direct only. Not available to Azure OpenAI.
gpt-4.1-mini-2025-04-141M tokens32k tokensHigh-volume text extraction from large documentsAvailable to all commercial orgs.
gpt-4.1-mini1M tokens32k tokensHigh-volume text extraction from large documentsOpenAI direct only. Not available to Azure OpenAI.
gpt-4.1-nano-2025-04-141M tokens32k tokens32k tokensReal-time processing of voluminous logs and transcriptsAvailable to all commercial orgs.
gpt-4.1-nano1M tokens32k tokensReal-time processing of voluminous logs and transcriptsOpenAI direct only. Not available to Azure OpenAI.
o3-2025-04-16200k tokens100k tokensRigorous logical deductionOpenAI direct only. Not available to Azure OpenAI.
o3200k tokens100k tokensIn-depth strategic planningOpenAI direct only. Not available to Azure OpenAI.
o3-mini-2025-01-31200k tokens100k tokensEducational tools for step-by-step learning pathsOpenAI direct only. Not available to Azure OpenAI.
o3-mini200k tokens100k tokensDebugging complex workflows with explanatory outputsOpenAI direct only. Not available to Azure OpenAI.
o1-2024-12-17200k tokens100k tokensMathematical proofs and logical puzzle solvingOpenAI direct only. Not available to Azure OpenAI.
o1200k tokens100k tokensCreative brainstorming with structured ideationOpenAI direct only. Not available to Azure OpenAI.
gpt-4o-2024-11-20128K tokens16k tokensContent generationOpenAI direct only. Not available to Azure OpenAI.
gpt-4o128K tokens16k tokensContent generationOpenAI direct only. Not available to Azure OpenAI.
gpt-4o-mini-2024-07-18128K tokens16k tokensQuick content drafting and idea generationOpenAI direct only. Not available to Azure OpenAI.
gpt-4o-mini128K tokens16k tokensQuick content drafting and idea generationOpenAI direct only. Not available to Azure OpenAI.
gpt-4o-search-preview128K tokens16k tokensReal-time information retrieval and fact-checked responsesOpenAI direct only. Not available to Azure OpenAI.