Production-ready agent infrastructure for IBM i system administration and performance monitoring. Built on Agno AgentOS with specialized IBM i agents that use MCP (Model Context Protocol) tools.
graph TB
UI[Agent UI<br/>Web Interface]
subgraph "AgentOS Stack"
Agents[IBM i Agents<br/>Performance · Discovery<br/>Browse · Search]
MCP[<b>IBM i MCP Server</b><br/>Central Tool Provider]
DB[(PostgreSQL<br/>Sessions & Memory)]
end
LLM[AI Models<br/>watsonx · OpenAI · Anthropic]
IBM_i[IBM i System<br/>Db2 Database]
UI -->|User Queries| Agents
Agents <-->|<b>MCP Protocol</b><br/><b>Tool Calls</b>| MCP
Agents -.->|Inference| LLM
Agents -->|Persist| DB
MCP -->|SQL Queries<br/>System Services| IBM_i
%% Styling with better contrast
classDef ui fill:#0288d1,stroke:#01579b,stroke-width:3px,color:#fff
classDef agents fill:#ff6f00,stroke:#e65100,stroke-width:3px,color:#fff
classDef mcp fill:#2e7d32,stroke:#1b5e20,stroke-width:4px,color:#fff
classDef external fill:#7b1fa2,stroke:#4a148c,stroke-width:2px,color:#fff
classDef database fill:#c2185b,stroke:#880e4f,stroke-width:2px,color:#fff
class UI ui
class Agents agents
class MCP mcp
class LLM,IBM_i external
class DB database
The IBM i Agent Infrastructure is built around the MCP Server as the central component, providing all agents with unified access to IBM i system data and services.
Key Components:
- Agent UI: Web-based chat interface for interacting with specialized agents
- IBM i Agents: Four specialized agents (Performance, Discovery, Browse, Search) that orchestrate IBM i operations
- MCP Server ⭐: Central tool provider enabling agents to query IBM i databases and system services via standardized protocol
- PostgreSQL: Persistent storage for agent sessions, memory, and conversation history
- AI Models: Multi-provider LLM support (watsonx, OpenAI, Anthropic) for agent intelligence
- IBM i System: Production IBM i environment with Db2 database
How It Works:
- Users interact with agents through the web UI
- Agents leverage the MCP Server to access IBM i data via tool calls
- MCP Server executes SQL queries and retrieves system information
- Agents use AI models for reasoning and natural language understanding
- All interactions are persisted in PostgreSQL for continuity
- Docker Desktop installed and running or Podman
- API key from at least one AI provider:
- watsonx API key (IBM Cloud) OR
- OpenAI API key OR
- Anthropic API key
Note: The IBM i MCP server runs automatically as part of the Docker Compose stack - no separate setup required!
Get the IBM i Agent Infrastructure running in 3 steps:
Navigate to the project directory:
cd appCreate infra/.env with your API keys (choose at least one provider):
# AI Model Provider (Choose at least one)
# Anthropic - Get from console.anthropic.com (default model)
ANTHROPIC_API_KEY=sk-your_anthropic_key
# watsonx (IBM Cloud) - Get from cloud.ibm.com
WATSONX_API_KEY=your_ibm_cloud_api_key
WATSONX_PROJECT_ID=your_project_id
# OpenAI - Get from platform.openai.com/api-keys
OPENAI_API_KEY=sk-your_openai_key📖 For detailed configuration options, including MCP settings, database configuration, and agent customization, see the Configuration Guide
Using ag CLI (recommended):
source .venv/bin/activate
ag infra upOr using Docker Compose directly:
docker compose up -d --buildThis starts:
- AgentOS API: http://localhost:8000
- IBM i MCP Server: http://localhost:3010 (automatically included)
- PostgreSQL Database:
localhost:5432 - Agent UI: http://localhost:3000 (optional)
- API Documentation: http://localhost:8000/docs
Once the application is running, you can interact with the agents in several ways:
- Open source Agent UI
- Direct API calls
- AgentOS Control Plane
Open http://localhost:3000 in your browser to interact with the agents via a user-friendly interface:

- add AgentOS endpoint
http://localhost:8000
Open http://localhost:8000/docs in your browser to access the Swagger UI where you can:
- Browse all available agents and endpoints
- Test agents directly in the browser
- View request/response schemas
- See example payloads
Use curl or any HTTP client to call the agents:
# Check IBM i system performance
curl -X 'POST' \
'http://localhost:8000/agents/ibmi-performance-monitor/runs' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'message=Check my system status' \
-F 'stream=false'- Open os.agno.com in your browser
- Click "Connect to Local" and enter
http://localhost:8000 - Select an agent from the sidebar
- Start chatting with the agent
Check that everything is running correctly:
# Check service health
curl http://localhost:8000/health
# List available agents
curl http://localhost:8000/agents
# View PostgreSQL database (optional)
docker compose exec postgres psql -U postgres -d agno -c "\dt"Stop the application:
ag infra down
# or: docker compose downRestart the application:
ag infra restart
# or: docker compose restartView logs:
docker compose logs -fCheck status:
docker compose ps❌ Error: "Unable to serialize unknown type: ModelInference"
Cause: This error occurs when the WatsonX model client can't be serialized for MCP communication.
Solution: This has been fixed in the latest version of agents/utils/filtered_mcp_tools.py. Make sure you're using the latest code:
git pull
docker compose up -d --build❌ Error: "cannot import name 'ParsedBetaContentBlockStopEvent' from 'anthropic'"
Cause: Incompatible version of the Anthropic SDK.
Solution: Update the Anthropic SDK version in pyproject.toml to >=0.80.0 and regenerate requirements:
./scripts/generate_requirements.sh
docker compose up -d --build🔌 MCP Connection Errors
Symptoms: "Failed to connect to MCP server" or timeout errors
Solutions:
-
Verify MCP server container is running:
docker compose ps ibmi-mcp-server curl http://localhost:3010/health
-
Check MCP server logs:
docker compose logs ibmi-mcp-server
-
Verify network configuration:
- The MCP server runs automatically in Docker Compose on
ibmi-mcp-server:3010 - Default
MCP_URLin.envshould be:http://ibmi-mcp-server:3010/mcp - See Configuration Guide for details
- The MCP server runs automatically in Docker Compose on
-
Restart the MCP server:
docker compose restart ibmi-mcp-server
🔑 API Key Issues
Symptoms: "Invalid API key" or authentication errors
Solutions:
-
Verify API keys are set correctly in
infra/.env:# Check if env file exists and has correct format cat infra/.env | grep API_KEY
-
Restart after changing .env:
docker compose down docker compose up -d
-
Test API keys directly:
- watsonx: Check at cloud.ibm.com
- OpenAI: Check at platform.openai.com/api-keys
📊 Database Connection Issues
Symptoms: "Failed to connect to database" errors
Solutions:
-
Check PostgreSQL is running:
docker compose ps postgres
-
Verify database credentials match in
infra/.envandcompose.yml -
Reset database (warning: deletes all data):
docker compose down -v docker compose up -d
🐛 Enable Debug Mode
To get more detailed logs for troubleshooting:
-
In
infra/.env:DEBUG=true LOG_LEVEL=DEBUG
-
In
infra/config.yaml(for specific agent):agents: ibmi-performance-monitor: debug_mode: true
-
Restart and view logs:
docker compose restart docker compose logs -f agent-api
📖 View Agent Logs
# All services
docker compose logs -f
# Specific service
docker compose logs -f agent-api
# Last 100 lines
docker compose logs --tail=100 agent-api
# Follow with timestamps
docker compose logs -f -t agent-apiThe infrastructure includes specialized agents for IBM i administration:
Monitor and analyze IBM i system performance.
Capabilities:
- System status and activity monitoring
- CPU utilization analysis
- Memory pool tracking
- Job performance analysis
- HTTP server metrics
API Endpoint: /agents/ibmi-performance-monitor
Three specialized agents for system administration:
Discovery Agent (/agents/ibmi-sysadmin-discovery):
- High-level system overviews
- Service category summaries
- Component inventories
Browse Agent (/agents/ibmi-sysadmin-browse):
- Detailed service exploration
- Schema-based browsing
- Object type filtering
Search Agent (/agents/ibmi-sysadmin-search):
- Service name searches
- Example code lookup
- Documentation searches
Pre-built workflows for common IBM i tasks (see workflows/):
- Simple Performance Check: Quick system health assessment
- Performance Investigation: Deep dive into performance issues
- Capacity Planning: Resource utilization forecasting
- Database Tuning: Db2 performance optimization
- System Health Audit: Comprehensive system analysis
To setup your local virtual environment:
We use uv for python environment and package management. Install it by following the the uv documentation or use the command below for unix-like systems:
curl -LsSf https://astral.sh/uv/install.sh | shRun the dev_setup.sh script. This will create a virtual environment and install project dependencies:
./scripts/dev_setup.shActivate the created virtual environment:
source .venv/bin/activate(On Windows, the command might differ, e.g., .venv\Scripts\activate)
If you need to add or update python dependencies:
Add or update your desired Python package dependencies in the [dependencies] section of the pyproject.toml file.
The requirements.txt file is used to build the application image. After modifying pyproject.toml, regenerate requirements.txt using:
./scripts/generate_requirements.shTo upgrade all existing dependencies to their latest compatible versions, run:
./scripts/generate_requirements.sh upgradeRebuild your Docker images to include the updated dependencies:
docker compose up -d --buildThis project comes with a set of integration tests that you can use to ensure the application is working as expected.
First, start the application:
docker compose up -dThen, run the tests:
pytest tests/Then close the application again:
docker compose downNeed help, have a question, or want to connect with the community?
- 📚 Read the Agno Docs for more in-depth information.
- 💬 Chat with us on Discord for live discussions.
- ❓ Ask a question on Discourse for community support.
- 🐛 Report an Issue on GitHub if you find a bug or have a feature request.
This repository includes a Dockerfile for building a production-ready container image of the application.
The general process to run in production is:
- Update the
scripts/build_image.shfile and set your IMAGE_NAME and IMAGE_TAG variables. - Build and push the image to your container registry:
./scripts/build_image.sh- Run in your cloud provider of choice.
- Configure for Production
- Ensure your production environment variables (e.g.,
OPENAI_API_KEY, database connection strings) are securely managed. Most cloud providers offer a way to set these as environment variables for your deployed service. - Review the agent configurations in the
/agentsdirectory and ensure they are set up for your production needs (e.g., correct model versions, any production-specific settings).
- Build Your Production Docker Image
-
Update the
scripts/build_image.shscript to set your desiredIMAGE_NAMEandIMAGE_TAG(e.g.,your-repo/agent-api:v1.0.0). -
Run the script to build and push the image:
./scripts/build_image.sh
- Deploy to a Cloud Service With your image in a registry, you can deploy it to various cloud services that support containerized applications. Some common options include:
-
Serverless Container Platforms:
- Google Cloud Run: A fully managed platform that automatically scales your stateless containers. Ideal for HTTP-driven applications.
- AWS App Runner: Similar to Cloud Run, AWS App Runner makes it easy to deploy containerized web applications and APIs at scale.
- Azure Container Apps: Build and deploy modern apps and microservices using serverless containers.
-
Container Orchestration Services:
- Amazon Elastic Container Service (ECS): A highly scalable, high-performance container orchestration service that supports Docker containers. Often used with AWS Fargate for serverless compute or EC2 instances for more control.
- Google Kubernetes Engine (GKE): A managed Kubernetes service for deploying, managing, and scaling containerized applications using Google infrastructure.
- Azure Kubernetes Service (AKS): A managed Kubernetes service for deploying and managing containerized applications in Azure.
-
Platform as a Service (PaaS) with Docker Support
- Railway.app: Offers a simple way to deploy applications from a Dockerfile. It handles infrastructure, scaling, and networking.
- Render: Another platform that simplifies deploying Docker containers, databases, and static sites.
- Heroku: While traditionally known for buildpacks, Heroku also supports deploying Docker containers.
-
Specialized Platforms:
- Modal: A platform designed for running Python code (including web servers like FastAPI) in the cloud, often with a focus on batch jobs, scheduled functions, and model inference, but can also serve web endpoints.
The specific deployment steps will vary depending on the chosen provider. Generally, you'll point the service to your container image in the registry and configure aspects like port mapping (the application runs on port 8000 by default inside the container), environment variables, scaling parameters, and any necessary database connections.
- Database Configuration
- The default
docker-compose.ymlsets up a PostgreSQL database for local development. In production, you will typically use a managed database service provided by your cloud provider (e.g., AWS RDS, Google Cloud SQL, Azure Database for PostgreSQL) for better reliability, scalability, and manageability. - Ensure your deployed application is configured with the correct database connection URL for your production database instance. This is usually set via an environment variables.
- Agno Documentation - AgentOS framework
- IBM i MCP Server - MCP server setup
- Configuration Guide - Environment setup