Create and Configure Your First AI Agent
Welcome to this step-by-step tutorial on Odoo 19 AI modules. In this guide, we will walk you through setting up your environment, installing required extensions, creating an AI agent, and connecting APIs. Moreover, we will provide clear instructions, best practices, and troubleshooting tips. Therefore, you can harness the power of AI directly inside Odoo without confusion.
Introduction to Odoo 19 AI Modules
First, you need to grasp what Odoo 19 AI modules bring to your business processes. Next, you will see that Odoo now offers built-in AI agents, vector stores, and API connectors. Moreover, these modules simplify tasks like summarizing documents, answering FAQs, and automating workflows. Therefore, by the end of this tutorial, you will have a working AI agent inside Odoo 19 CE or EE.
Prerequisites and Environment Setup
Before diving in, ensure you meet the following requirements:
- Odoo 19 Installation
You must run Odoo 19 (Community or Enterprise) on a Linux server or your local machine. - PostgreSQL 17+
Moreover, you need PostgreSQL version 17 or higher to support the PGVector extension. - PGVector Extension
Install the PGVector extension if you plan to use your database as a vector store. - Developer Mode
Activate developer mode in Odoo to reveal advanced settings and menu items. - Python Dependencies
Use a virtual environment and run:
pip install odoo19-addon-ai odoo19-addon-ai-vector
- API Keys
Obtain your OpenAI key (or Anthropic, etc.) and note it for configuration.
Once you have these items, you can proceed to enable AI features.
Understanding Odoo 19 AI Framework
Odoo 19 AI Modules Overview
First, the Odoo 19 AI framework introduces two key addons:
- AI Core
This module delivers the base models and the agent scheduler. - AI Tools
This addon offers built-in tools like ChatGPT, PDF Reader, and Web Search.
Consequently, you can mix and match tools to create powerful agents.
Key Concepts and Components
- Agent
An AI entity that executes chains of tools and prompts. - Tool
A single functionality, such as calling a chat model or fetching a webpage. - Vector Store
A database that holds embeddings for semantic search. - Server Action
A clickable action in Odoo that triggers your agent.
Step 1: Enable Developer Mode and AI Features
First, log in to your Odoo instance as an administrator. Then follow these steps:
- Activate Developer Mode
- Click your user dropdown.
- Select Settings.
- Click Activate the developer mode link at the bottom.
- Install AI Addons
- Go to Apps → Update Apps List.
- Search for AI Core and AI Tools.
- Click Install on both modules.
- Verify Installation
- Check that you see a new menu AI Agents under Settings.
- Confirm no errors appear in the logs.
Now, you have enabled the base for Odoo 19 AI modules and you can proceed.
Step 2: Install and Configure Vector Database
Choosing Your Vector Store
First, you must pick between two options:
- PGVector on PostgreSQL
- External Vector Database (e.g., Weaviate)
If you choose PGVector, continue below; otherwise skip to External Setup.
H2: PGVector Installation
- Install Extension
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS vector;"
- Grant Access
sudo -u postgres psql -c "GRANT ALL ON EXTENSION vector TO odoo;"
- Restart Odoo
sudo systemctl restart odoo
H3: External Vector Database
- Deploy Weaviate (or your service of choice).
- Note the Endpoint URL and API key.
- Configure in Odoo
- Go to Settings → AI → Vector Stores.
- Click Create.
- Choose Weaviate and fill in credentials.
Once you complete this step, your agent can store embeddings.
Step 3: Create Your First AI Agent
H2: Define a New Agent Record
- Navigate to Settings → AI Agents.
- Click New.
- Fill in:
- Name: “Support Bot”
- Description: “Answer customer questions”
- Vector Store: Select your PGVector or Weaviate record
- Click Save.
H3: Configure Agent Settings
- Max Tokens: 512
- Temperature: 0.2 (for reliable answers)
- Model: Choose gpt-4 or custom
Consequently, you establish an agent ready to accept tools and actions.
Step 4: Connect External APIs
First, you must register your API keys as system parameters.
- Go to Settings → Technical → System Parameters.
- Click Create and set:
- Key:
openai.api_key - Value: your OpenAI key
- Repeat for any other provider, such as:
anthropic.api_keyhuggingface.api_key
Next, test your configuration:
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY"
Thus, you verify that Odoo can call the service.
Step 5: Add Tools to Your AI Agent
H2: Attach ChatGPT Tool
- Open your agent record.
- Under Tools, click Add a line.
- Choose ChatGPT.
- Set Name: “Chat Helper”.
- Save.
H3: Attach PDF Reader Tool
- Click Add a line again.
- Choose PDF Reader.
- Name it “Doc Reader”.
- Save.
Consequently, your agent can now summarize documents and chat.
Step 6: Define a Server Action for AI
First, create an Odoo server action that kicks off your agent.
- Go to Settings → Technical → Actions → Server Actions.
- Click Create.
- Fill in:
- Action Name: “Run Support Bot”
- Model:
res.partner(for customers) - Action To Do: Execute Python Code
- In the code box, insert:
record = env[context['active_model']].browse(context['active_id'])
agent = env['ai.agent'].search([('name', '=', 'Support Bot')], limit=1)
response = agent.run({
'input': record.comment or record.name,
'context': {'partner_id': record.id}
})
action = {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': 'AI Response',
'message': response.get('text'),
'type': 'success',
}
}
return action
- Click Save.
Next, add a button in the partner form view:
<button name="%(action_id)d"
string="Ask AI"
type="action"
class="btn-primary"/>
Therefore, users can click “Ask AI” to get instant answers.
Step 7: Integrate Chat UI into Odoo
H2: Add Chat Widget to Your Dashboard
First, install the frontend addon:
pip install odoo19-chat-widget
Next, enable it:
- Go to Apps → Update Apps List.
- Find Chat Widget.
- Click Install.
Finally, include the widget in your template:
<template id="assets_frontend" inherit_id="web.assets_frontend">
<xpath expr="." position="inside">
<script src="/chat_widget/static/js/chat.js"></script>
<link href="/chat_widget/static/css/chat.css" rel="stylesheet"/>
</xpath>
</template>
Consequently, your users can chat directly on the website.
Step 8: Test and Iterate Your AI Agent
First, validate your setup:
- Open a customer record.
- Click Ask AI.
- Enter a sample question.
- Observe the response notification.
Next, refine prompts:
- Adjust the temperature for more creative answers.
- Change max tokens for longer outputs.
Moreover, monitor logs in Settings → Technical → Logs to catch errors.
Advanced Tuning of AI Modules
H2: Customize Prompt Templates
- Go to Settings → AI → Prompt Templates.
- Click Create.
- Define:
- Name: “Support Prompt”
- Template:
You are a customer support assistant. When user asks: {{ input }}, answer concisely.
- Save and attach to your tool.
H3: Chain Multiple Tools
- Combine PDF Reader and ChatGPT to answer document-based queries.
- For example, build a chain:
- Extract text.
- Generate summary.
- Answer question based on summary.
Troubleshooting Common Issues
H2: “Agent not found” Error
- Cause: You used the wrong agent name in server action.
- Fix: Verify the exact agent record name under Settings → AI Agents.
H3: “API Key Invalid”
- Cause: You set the system parameter incorrectly.
- Fix: Go to Settings → Technical → System Parameters and correct the key.
Best Practices for Odoo AI Integration
H2: Secure Your API Keys
First, never hard-code keys in code. Then, always use system parameters.
H3: Monitor Usage and Costs
- Track token usage in OpenAI dashboard.
- Set limits in Odoo: Settings → AI → Rate Limits.
H4: Document Your Agents
Keep a README in your custom module:
# Support Bot Agent
- Tools: ChatGPT, PDF Reader
- Prompt: Support Prompt
- Model: gpt-4, temperature=0.2
Conclusion and Next Steps
Throughout this tutorial, you learned to:
- Enable Odoo 19 AI modules features.
- Configure vector stores.
- Create and customize an AI agent.
- Connect APIs and add tools.
- Define server actions and chat UI.
Consequently, you can now build advanced AI assistants inside Odoo. Next, explore integrating more tools like web scrapers or custom ML models.
Further Resources
- Official Odoo AI Documentation: Odoo AI Guide
- PGVector Extension Guide: PGVector on Postgres
- OpenAI API Reference: OpenAI Docs
Feel free to experiment, adjust settings, and share your feedback in the Odoo community forums.
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.


Pingback: Odoo 19 AI Integration: 5 Revolutionary Business Secrets
Pingback: Amazing Odoo 19 AI Features: 9 Game-Changers