Agent Testing Guide
This guide documents the testing process for OpenRegister agents with tool integration, specifically focusing on the CMS Tool from OpenCatalogi.
Overview
OpenRegister provides an AI agent framework that allows agents to interact with Nextcloud apps through tools. This guide covers:
- Setting up the testing environment
- Creating and configuring agents
- Testing tool integration
- Verifying agent operations
- Troubleshooting common issues
Architecture
The agent system consists of several components:
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Ollama │◄─────│ OpenRegister│◄─────│ OpenCatalogi│
│ (LLM) │ │ (Agents) │ │ (CMS Tool) │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────┐
│ Nextcloud with MySQL Database │
└─────────────────────────────────────────────────────────┘
Components
- Ollama: Local LLM inference server providing AI capabilities
- OpenRegister: Agent management and execution framework
- OpenCatalogi: CMS functionality with Tool interface
- Tools: Interfaces that allow agents to interact with app functionality
- Endpoints: API routes that invoke agents with natural language input
Prerequisites
Container Setup
Ensure the following containers are running:
# Check container status
docker ps | grep -E 'nextcloud|ollama|database'
Expected containers:
master-nextcloud-1- Nextcloud application serveropenregister-ollamaormaster-ollama-1- Ollama LLM servermaster-database-mysql-1- MySQL database
App Status
# Verify apps are enabled
docker exec -u 33 master-nextcloud-1 php occ app:list | grep -E 'openregister|opencatalogi'
Expected output:
- opencatalogi: 0.7.2
- openregister: 0.2.7
Ollama Configuration
# Check Ollama API
curl http://localhost:11434/api/tags
# Pull required model (if not present)
docker exec openregister-ollama ollama pull llama3.2:latest
Database Setup
OpenRegister requires several database tables. If API routes return 404 errors, tables may need to be created manually:
Required Tables
-- Agents table
CREATE TABLE IF NOT EXISTS oc_openregister_agents (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
uuid varchar(255) NOT NULL,
name varchar(255) NOT NULL,
description text,
provider varchar(50),
model varchar(255),
prompt text,
temperature decimal(3,2),
tools text,
active tinyint(1) NOT NULL DEFAULT 1,
owner varchar(255),
created datetime NOT NULL,
updated datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY agents_uuid_index (uuid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Endpoints table
CREATE TABLE IF NOT EXISTS oc_openregister_endpoints (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
uuid varchar(255) NOT NULL,
name varchar(255) NOT NULL,
description text,
endpoint varchar(1024) NOT NULL,
method varchar(10) DEFAULT 'GET',
target_type varchar(50),
target_id varchar(255),
created datetime NOT NULL,
updated datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY endpoints_uuid_index (uuid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Objects table (for CMS data)
CREATE TABLE IF NOT EXISTS oc_openregister_objects (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
uuid varchar(255) NOT NULL,
schema varchar(255),
register varchar(255),
title varchar(500),
summary text,
description text,
object longtext,
created datetime NOT NULL,
updated datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY objects_uuid_index (uuid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Testing Process
1. Create Test Agent
Agents can be created via API or directly in the database.
Via PHP Script (Recommended for testing)
docker exec -u 33 master-nextcloud-1 php \
/var/www/html/apps-extra/openregister/test-agent-creation.php
Agent Configuration
{
"name": "CMS Test Agent",
"description": "Agent for testing CMS operations with OpenCatalogi",
"provider": "ollama",
"model": "llama3.2:latest",
"prompt": "You are a helpful assistant that manages website content. You can create menus and menu items for websites using the CMS tools available to you.",
"tools": ["CMS Tool"],
"temperature": 0.7,
"active": true
}
Verify Agent Creation
-- Check agent in database
SELECT id, uuid, name, provider, model, tools, active
FROM oc_openregister_agents
WHERE name = 'CMS Test Agent';
2. Create Endpoint
Endpoints route API requests to agents.
docker exec -u 33 master-nextcloud-1 php \
/var/www/html/apps-extra/openregister/test-endpoint-creation.php
Endpoint Configuration
{
"name": "CMS Agent Endpoint",
"description": "Endpoint for testing CMS operations via agent",
"endpoint": "/test/cms/agent",
"method": "POST",
"targetType": "agent",
"targetId": "{agent-uuid}"
}
3. Test CMS Functionality
Test creating menus and menu items:
docker exec -u 33 master-nextcloud-1 php \
/var/www/html/apps-extra/openregister/test-cms-functionality.php
This test:
- Creates a menu ('Main Navigation')
- Creates 4 menu items (Home, About, Services, Contact)
- Verifies data in the database
- Displays menu structure
Expected Output
🍔 Testing CMS Functionality (Menus & Menu Items)
=============================================================
📋 Step 1: Creating a test menu...
✅ Menu created successfully!
ID: 1
UUID: 426bbe23-bcf0-49a9-a52a-b441f6fd96b8
Title: Main Navigation
🔗 Step 2: Creating menu items...
✓ Created: Home -> /home (ID: 2)
✓ Created: About -> /about (ID: 3)
✓ Created: Services -> /services (ID: 4)
✓ Created: Contact -> /contact (ID: 5)
📊 Step 4: Testing data retrieval...
Menu: Main Navigation
• Home → /home (Order: 1)
• About → /about (Order: 2)
• Services → /services (Order: 3)
• Contact → /contact (Order: 4)
✅ CMS Functionality Test Complete!
4. Verify Database
-- List all menus
SELECT id, uuid, title, schema
FROM oc_openregister_objects
WHERE schema = 'menu';
-- List all menu items
SELECT id, uuid, title, schema, object
FROM oc_openregister_objects
WHERE schema = 'menuItem';
Newman/Postman Tests
Automated API tests are available in the Newman test collection.