Skip to main content

Introduction

AI Agents in Xano allow you to define intelligent, autonomous workflows powered by models like Gemini, OpenAI, or Claude, directly in XanoScript.

Anatomy

Every XanoScript Agent follows a predictable structure. Here’s a quick visual overview of its main building blocks — from declaration at the top to tools at the bottom.

It’s a little different from other primitives, because the settings are defined in the llm block, instead of a separate settings block.

You can find more detail about each section by continuing below.

Section 1: Declaration

Every Agent starts with a declarative header that specifies its type, name, and description.
XanoScript
agent "Answer a Question" {
description = "This agent answers the user's question to the best of its ability."
canonical = "Zwt3YW_3"
tags = ["tag1", "tag2"]
}
ElementRequiredDescription
agentDeclares an Agent primitive and its name.
descriptionnoOptional human-readable description of the task.
canonicalnoThe canonical ID for this Agent.
tagsnoAn array of strings used to categorize or filter Agents.

Section 2: LLM

The llm block defines how your Agent interacts with its underlying AI model. All standard model configuration options available in the UI are represented here. These are a little different from other primitives, because the settings available can change based on the model chosen.
XanoScript
llm = {
type            : "google-genai"
system_prompt   : "You are a helpful AI Agent that tries to answer the user's query using the best possible information. You are also required to log each interaction using the logging tool."
max_steps       : 5
prompt          : "Here is the user's query: {{ $args.query }}"
...
ElementRequiredDescription
typeThe model host provider. Supported: openai, anthropic, google-genai, xano-free.
system_promptnoCore instructions defining the Agent’s role and behavior.
max_stepsnoHow many steps (tool calls) the Agent can take before stopping.
promptnoAdditional context or message prompt. Use {{ $args.property }} for dynamic data.
api_keynoAPI key for the chosen model provider.
modelnoSpecific model to use.

Xano Free Model (Gemini)

These settings are specific to the Xano Free Model (Gemini).
XanoScript
temperature     : 1
search_grounding: false
thinking_tokens : 0
include_thoughts: false
ElementRequiredDescription
temperaturenoControls randomness of output. Lower = more deterministic.
search_groundingnoFor Gemini, whether to enable Google Search grounding.
thinking_tokensnoFor reasoning models, sets thinking budget.
include_thoughtsnoWhether to include reasoning traces in the response.

Anthropic (Claude)

XanoScript
    api_key      : "abc123"
    model        : "claude-4-sonnet-20250514"
    temperature  : 1
    reasoning    : true
ElementRequiredDescription
api_keyAPI key for the chosen model provider.
modelSpecific model to use.
temperaturenoControls randomness of output. Lower = more deterministic.
reasoningnoWhether to include reasoning traces in the response.

Google Generative AI (Gemini)

XanoScript
    api_key         : "abc123"
    model           : "gemini-2.5-flash"
    temperature     : 1
    search_grounding: false
    thinking_tokens : 0
    include_thoughts: false
ElementRequiredDescription
api_keyAPI key for the chosen model provider.
modelSpecific model to use.
temperaturenoControls randomness of output. Lower = more deterministic.
search_groundingnoFor Gemini, whether to enable Google Search grounding.
thinking_tokensnoFor reasoning models, sets thinking budget.
include_thoughtsnoWhether to include reasoning traces in the response.

OpenAI

OpenAI settings are similar to the other models, but also includes some additional advanced settings.

OpenAI Settings

XanoScript
    api_key         : "abc123"
    model           : "gpt-5-mini"
    temperature     : 1
    reasoning_effort: ""
ElementRequiredDescription
api_keyAPI key for the chosen model provider.
modelSpecific model to use.
temperaturenoControls randomness of output. Lower = more deterministic.
reasoning_effortnoFor reasoning models, sets how much effort the model spends thinking during generation.

OpenAI Advanced Settings

XanoScript
    organization    : ""
    project         : ""
    compatibility   : "strict"
ElementRequiredDescription
organizationnoThe organization to use.
projectnoThe project to use.
compatibilitynoThe compatibility level to use.

Section 3: Tools

The tools block defines the tools that an Agent can use. Tools are functions that an Agent can call as part of its steps to resolve the task at hand.
XanoScript
tools = [
  { name: "Get_User_Info" },
  { name: "Create_Support_Ticket" }
]
ElementRequiredDescription
tools[]The tools that the Agent can use.
      nameThe name of the tool.

Full Example

Below is a more complete Agent definition that combines multiple settings:
agent "Customer Support Agent" {
  description = "Handles customer inquiries and support requests automatically."
  canonical   = "SUPPORT_AGENT_001"
  tags        = ["support", "customer-service"]

  llm = {
    type            : "anthropic"
    system_prompt   : "You are a helpful Customer Support Agent that resolves issues efficiently..."
    max_steps       : 8
    prompt          : "Customer inquiry: {{ $args.customer_message }}"
    api_key         : "{{ $env.ANTHROPIC_KEY }}"
    model           : "claude-3-7-sonnet-latest"
    temperature     : 0.3
    send_reasoning  : true
    thinking        : {
      type          : "enabled",
      budget_tokens : 10000
    }
  }

  tools = [
    { name: "Get_User_Info" },
    { name: "Update_User_Info" },
    { name: "Create_Ticket" }
  ]
}

What’s Next

Now that you understand how to define Agents in XanoScript, here are a few great next steps:

Explore the function reference

Learn about the built-in functions available in the stack to start writing more complex logic.
https://mintlify.s3.us-west-1.amazonaws.com/xano-997cb9ee/images/vscode.svg

Try it out in VS Code

Use the XanoScript VS Code extension with Copilot to write XanoScript in your favorite IDE.

Learn about AI Tools

AI Tools are used to define the actions that an Agent can take.
I