Home / Guides / Adding AI to OutSystems apps

Adding AI to OutSystems apps: models, agents and grounding in ODC

Short answer: you can add AI to an OutSystems app without leaving the platform, and on ODC most of the plumbing is built in. You connect a model from one of 10 supported providers in the ODC Portal and call it as a server action. You build agents as a separate Agentic app with grounding, memory and tool actions, and you ground answers in your own data with native semantic search and knowledge bases. OutSystems 11 doesn't document equivalent native features; there you integrate AI services over REST.

By Hamza Gulzar, OutSystems Developer & Solution Architect. Published 29 November 2026. Based on OutSystems documentation current at that date.

Two different things

AI in your app, or AI building your app?

"AI in OutSystems" means two separate things, and they're often confused:

  • AI embedded in your application: your users talk to a model or an agent, for example a support assistant or a document classifier. This guide is mostly about this.
  • AI coding agents building your application: tools such as Claude Code or Cursor work on your ODC apps through OutSystems MCP. See the section on coding agents below.
Models

How do you connect an AI model in ODC?

"ODC lets you connect your OutSystems apps to external large language models from various providers or use pre-configured ODC trial models for experimentation."

  • Providers supported natively: AI21, Amazon Bedrock, Anthropic, Azure OpenAI, Cohere, Databricks, Gemini, IBM watsonx.ai, Mistral and OpenAI. Anything else connects through a custom connection that follows the ODC API contract.
  • Configuration: an administrator adds the connection in the ODC Portal with the endpoint details of your own provider account. "The Save button only becomes available after a successful test." You can add several endpoints to one connection; "Lower-priority endpoints act as fallbacks", and they should use the same model and version.
  • Amazon Bedrock: an IAM role is the recommended authentication, and "OutSystems doesn't store any AWS credentials."
  • In the app: add the model as a public element in ODC Studio and call the generated Call<ModelName> server action.
  • Usage limit: you can "set a daily token limit to control the model consumption".

Trial models are "for quick testing and exploration in the development stage", with fixed caps:

Trial modelLicensed customersPersonal Edition
GPT-5100 requestsNot listed
Claude Haiku 4.51,000 requests3,000 requests, 5 million tokens
Amazon Nova Pro1,000 requests1,000 requests, 1 million tokens

"Trial models have limits, which, when reached, prevent the further use of the models." Plan production on your own provider account from the start.

Source: OutSystems: Adding AI models (last updated 21 October 2026)

Model or agent

Do you need an agent, or is one model call enough?

OutSystems defines them separately: "AI model: The LLM that provides intelligence, reasoning, and generation capabilities." "AI agent: The system you build around the model." In ODC an agent lives in its own Agentic app, which your other apps call, and "ensure the agentic app is deployed to that stage first" before a consumer app that depends on it.

UseWhenExamples
A direct Call<ModelName>One input, one output, no tools, no conversation historySummarise a ticket, classify an email, extract fields from a document
An agentSeveral steps, a conversation, your data, or actions the model may choose to runA support assistant that looks up orders and drafts replies

Our reading: start with a direct model call and move to an agent only when you need memory, tools or several steps. An agent adds a second app to deploy and version, more tokens per request because of its reasoning loops, and more behaviour to test.

Sources: Build AI-powered apps, Consuming AI agents in apps

Agents

How does an ODC agent work?

"An AgentFlow server action encapsulates the agent functionality." A typical flow has four steps:

01

GetGroundingData

A server action you write "to retrieve contextual or grounding data": a semantic search, a knowledge base search, an external search service, a REST API, an aggregate or static text.

02

BuildMessages

"Builds the prompt and conversation history that the model receives." You set the system prompt here with an Assign node.

03

Call<AIModelName>

Calls the model, added from the Call Agent toolbox element. One Agentic app can hold several agents, each with its own model.

04

StoreMemory

"Saves the conversation or generated information for future reference." Memory is explicit: you decide what to store.

Calling the agent: the agent appears to other apps as a Call<AgentName> service action. The consumer app "must pass the UserInput and SessionId parameters" and reads the answer from the Response output. Generate a new SessionId with GenerateGuid per conversation, and reuse it for follow-up turns so the agent can find the history.

Sources: Creating an agent in ODC Studio (last updated 13 November 2026), Consuming AI agents in apps, Agentic apps in ODC

Grounding and RAG

How do you ground answers in your own data?

"Grounding means providing an AI model with relevant, factual, real-world context and data specific to the task." This is retrieval-augmented generation (RAG), and ODC has it built in.

RAG stepNative in ODCExternal option
Text extractionSemantic search extracts text from files. To pass a document to a model, the OmniDoc2MD Forge component's ConvertDocumentToMarkdown handles DOCX, PDF, PPTX, XLSX, HTML and plain textYour own extraction service
ChunkingDone by the platform. Methods: Smart (default), Fixed-size, Sentence-based (text attributes only) and Recursive. A knowledge base's method is fixed when you create itDone by the search service
Embeddings and index"The platform manages the embedding model, the index, and the indexing."Azure AI Search, Amazon Kendra, or a custom data source that follows the ODC API contract
RetrievalThe Semantic Search node over text and File attributes, or SearchKB<KnowledgeBaseName> for a knowledge baseA generated Search action for the connection
GenerationYour agent's BuildMessages puts the retrieved chunks into the prompt; the model answers

Example: a policy assistant for employees

  1. An administrator creates a knowledge base in the ODC Portal and uploads the HR policy PDFs. "The platform indexes each file after the upload." Each stage has its own files.
  2. In the agent, GetGroundingData calls SearchKB<Policies> with the employee's question as Query (up to 8,192 characters), TopK 5 (the default; 1 to 50) and a MinimumScore so weak matches are dropped. Filters can narrow by fields such as language or document ID.
  3. Each result comes back with Id, Title, Content, Score and Attributes. BuildMessages adds the content and titles to the prompt, with instructions to answer only from them and name the source document.
  4. Your screen shows the answer and the source titles from the search results, not just the model's text.

The platform returns sources; citing them is a prompt instruction. Anthropic's advice: "Verify with citations: Make Claude's response auditable by having it cite quotes and sources for each of its claims."

Knowledge bases and semantic search over text attributes need ODC Studio 1.7.15 or later; search over File attributes needs 1.7.20 or later.

Sources: Semantic search over text attributes, Create and manage a knowledge base, Semantic search inputs and results, Integrating AI models and search services, Convert files to Markdown, Anthropic: Reduce hallucinations

Actions

How do you let an agent take actions safely?

"Actions are server actions", and "Providing actions is optional." The model chooses which action to run from the prompts and from each action's name, description and input parameters, so write those descriptions for the model, plainly. A parameter set to "Generated by AI" is filled in by the model.

  • Permissions: an action runs as server logic in your app. Check the end user's roles inside the action itself; don't rely on the prompt to stop a call.
  • Input validation: treat every model-generated parameter as untrusted input. Validate types, ranges and ownership (for example, that the order belongs to the signed-in user) before you act.
  • Sensitive operations: don't expose deletes, payments or bulk updates as agent actions. Have the action create a request for a person to approve instead; ODC Workflows include human activities for this.
  • Stopping runaway loops: a call condition can use TokenUsage, LoopCount and TotalCallsCount, for example TokenUsage >= 3000 or TotalCallsCount >= 30. "The agent then stops execution and raises an error to prevent infinite loops or excessive resource consumption."
  • Audit: log which action ran, for whom and with which parameters. ODC also offers agent execution traces.
  • Limitation: "Action calling and structured output can't be used on the same Agent call." Use one call to act and a second to produce structured output.

Agents can also use tools from MCP servers: "Tools exposed by an MCP server become server actions that agents can call." ODC supports Streamable HTTP and SSE transports, with OAuth, API key or no authentication.

Sources: AI agent actions (last updated 5 September 2026), Use MCP servers

Architecture

A reference architecture

Whatever you build, keep the model behind your own authorization and validation. The model is always an external service, and retrieval can be native or external.

Reference architecture for AI in an OutSystems appA request flows from the user through the OutSystems app, authentication and authorization, business logic, grounding and retrieval, the AI model or agent, and response validation back to the user. The AI model is hosted by an external provider; retrieval can be native ODC semantic search or an external search service.UserSigns in to your web or mobile appOutSystems appScreens and client logicAuthentication and authorizationEnd-user roles, checked on the serverBusiness logicValidates input, decides what AI may seeGrounding and retrievalNative search or an external serviceAI model or agentHosted by your model providerResponse validationChecks output before acting on itUserAnswer, with sources they can checkBuilt in OutSystemsExternal service
Reference architecture. Every AI call passes through your own authorization and validation logic.
Security

What does enterprise AI security need to cover?

The OWASP Top 10 for LLM Applications (2025) is a useful checklist. These are the items that matter most for an OutSystems app:

RiskWhat to do in OutSystems
LLM01 Prompt InjectionRetrieved documents and user text can contain instructions. Keep your instructions in the system prompt, treat retrieved text as data, and never let model output decide authorization
LLM02 Sensitive Information Disclosure"The Semantic Search node doesn't check whether the end user can access a record or a file." Apply Filters for the user's permissions before anything reaches the prompt
LLM05 Improper Output HandlingValidate model output before you save it, show it as HTML or pass it to an action
LLM06 Excessive AgencyGive agents the fewest actions possible, check roles inside each action, and route sensitive changes to human approval
LLM10 Unbounded ConsumptionDaily token limits on model connections, call conditions on agents, Max Tokens on responses
  • API keys: keep provider credentials in the ODC Portal model connection, never in app code or client logic. For Bedrock, prefer the IAM role.
  • Data sent to the provider: everything in the prompt goes to your model provider. Check your provider contract for data retention and training use, and keep personal data out of prompts where you can.
  • Memory retention: the documentation doesn't state a retention period for what StoreMemory saves, so decide and implement your own.
  • Monitoring: Anthropic recommends you "Regularly analyze outputs for signs of successful injection" and "Red-team your own agent."

Sources: OWASP Top 10 for LLM Applications 2025, OutSystems: Semantic search inputs and results, Anthropic: Mitigate jailbreaks and prompt injections

Cost and performance

How do you control cost and latency?

  • Model choice is the biggest lever. On Anthropic's API, for example, Claude Haiku 5.5 is $0.10 per million input tokens (prompts up to 100,000 tokens) and Claude Opus 5.5 is $4, a 40x difference. Use the smallest model that passes your tests. See current prices.
  • Context size: every retrieved chunk is paid for on every call. Tune TopK and MinimumScore before you reach for a bigger model.
  • Output length: Max Tokens "limits the final response length by returning a successful but potentially truncated output", without an error. Check for truncated answers.
  • Agent loops: each loop is another model call. Cap them with a call condition.
  • Fallbacks: a second, lower-priority endpoint on the model connection acts as a fallback.
  • Timeouts: agents are called as service actions, which have platform timeouts. OutSystems documents how to handle timeouts on AI agent calls; for long tasks, run the agent asynchronously, for example from a workflow, rather than while the user waits.

Our reading: measure latency and token use per request in a test stage before launch. Concurrency and rate limits come from your model provider's account tier, so check those limits against your expected peak.

Sources: AI agent actions, Adding AI models, Claude API pricing

O11 vs ODC

What about OutSystems 11?

CapabilityODCO11
Connect an LLMNative: 10 providers plus custom connectionsNo native model connection documented; call the provider's REST API yourself
AgentsNative Agentic appsNot documented; build the orchestration yourself
RAGNative semantic search and knowledge bases, or Azure AI Search and Amazon KendraNot documented; integrate an external search service over REST
Older AI connectorsNot applicableDocumented connectors for Azure LUIS, Azure QnA Maker, Azure ML, an AI Language Analysis component and chatbots
Coding agents (MCP)OutSystems MCP generally availableThe O11 documentation has an OutSystems MCP section

Our reading: the O11 connectors target older Azure AI services, so check each service's current status with Microsoft before building on it. For new AI features on O11, a REST integration with a current model provider is the more future-proof route, and an ODC app can read O11 data directly; see using O11 data from ODC apps.

Sources: OutSystems 11 documentation, ODC: Build AI-powered apps

Building with agents

Can AI coding agents build OutSystems apps?

Yes, on ODC. "OutSystems Model Context Protocol (MCP) is now generally available on every ODC tenant." It connects coding agents "such as Claude Code, Codex, Cursor, or AWS Kiro" to your tenant's MCP endpoint. The agent can hand work to Mentor, which "produces the same OutSystems app model as ODC Studio", inspect screens, data models, logic and roles, publish and check the impact on dependent apps, and read logs and traces. "Every action runs as you, with your existing ODC roles, approvals, and audit trail."

OutSystems calls this layer Agent Experience and announced it as generally available on 7 October 2026. Its customer results are vendor claims; we haven't seen independent measurements yet.

Our reading: this doesn't replace the architecture above. A coding agent can build the agent, the grounding and the actions faster, but someone still has to decide what data the AI may see and which actions need a human.

Sources: OutSystems MCP, OutSystems MCP on GitHub, OutSystems: Agent Experience announcement

Common mistakes

Mistakes to avoid

  • Building an agent where one model call would do.
  • Running semantic search without permission filters, so the AI can see records the user can't.
  • Letting the agent write data without validating its parameters inside the action.
  • No token caps, so one looping conversation burns a day's budget.
  • Planning on trial models, which are capped and meant for the development stage.
  • Showing model text as the only answer, with no sources the user can check.
About the author

Who wrote this

Hamza Gulzar is an OutSystems Developer and Solution Architect who has built on OutSystems since 2017. He holds 10 OutSystems certifications, including Architecture Specialist, Security Specialist and ODC Associate Developer, and trains and mentors OutSystems developers. Platform facts in this guide are quoted from the sources linked under each section; our own recommendations are marked "Our reading".

Related

Related guides and services

Weighing whether to stay on the platform at all? See Moving an OutSystems app to code with AI tools. For costs, see AI coding tools vs low-code: what each one costs. Still on O11? Start with O11 vs ODC and our ODC migration services.

For OutSystems projects, see our OutSystems development services.

Need help adding AI to your OutSystems app?

Tell us what the app does and what you want the AI to handle. We'll suggest an architecture that fits.