LLM Functions enable your AI Agent to perform tasks such as extracting structured data, summarizing conversations, classifying intent, or generating responses using a large language model. Instructions define what the model should do and how to return the results, using natural language that can reference input parameters or dynamic data.
To ensure accurate and consistent outputs, instructions should be clear, precise, and structured. They should specify the task, the input data to use, and the expected output format.
When writing LLM Function Instructions, follow the guidelines below:
- Describe the task clearly: State exactly what you want the model to do.
- Define strict extraction rules: Always instruct the model to only use explicitly provided information. Avoid assumptions by including rules such as: Only extract mentioned information and use null for missing data.
- Specify input data: Indicate which inputs the model should use. You can reference inputs using dynamic info such as {{input_name}}.
- Require structured JSON output: Always request the response in clean JSON format with exact field names. This ensures that the output can be reliably processed by downstream systems.
- Define field-level requirements: For each field, specify:
- Format (for example, date format like "YYYY-MM-DD" for dates)
- Allowed values (for example, predefined status values "pending/shipped/delivered")
- How to handle missing data (for example, use null or an empty array)
Example
Below is an example of a well-structured LLM Function Instruction:
You are an order information extraction assistant. Extract order details from the provided input parameters and chat history. Return ONLY valid JSON with no additional text before or after.
EXTRACTION RULES:
- ONLY extract information explicitly mentioned
- Do NOT invent, assume, or calculate missing data
- Use null for fields not mentioned.
JSON OUTPUT FORMAT:
"order_datetime": "YYYY-MM-DD HH:MM:SS" or null,
"order_status": "status_value" or null,
"items": [{"name": "string", "quantity": number, "price": number or null}] or [],
"customer_type": "type_value" or null,
"comment": "string" or null
}
FIELD DETAILS:
- order_datetime: "YYYY-MM-DD HH:MM:SS" format (use 00:00:00 if time not mentioned)
- order_status: pending/processing/shipped/delivered/delayed/cancelled
- items: [{"name": "string", "quantity": number, "price": number or null}]
- customer_type: new/returning/premium/vip/regular
- comment: Special requests, delivery notes, or concerns
Output EXAMPLE:
{"order_datetime":"2025-12-18 00:00:00","order_status":"processing","items":[{"name":"keyboard","quantity":1,"price":null}],"customer_type":"premium","comment":null}