Building AI Agents for IBM i
This guide covers the core concepts for building AI agents that work with IBM i systems using the agno framework and the MCP (Model Context Protocol) server. Focus is on using FilteredMCPTools to create specialized agents with ta### Connection Security The MCP server supports secure connections and authentication:Best Practices for IBM i Agents.
Framework Focus: This documentation focuses on agno, a modern Python AI agent framework. Documentation for LangChain and LangGraph integration will be added in future releases.
Core Concepts
Agent Architecture with agno
IBM i agents built with agno follow a specialized architecture that combines:Toolset Filtering
Use FilteredMCPTools to limit agents to specific IBM i domains (performance, discovery, etc.)
Domain Specialization
Create focused agents for specific IBM i administrative tasks and workflows
MCP Integration
Connect to your IBM i MCP server with streamable HTTP transport for reliable tool access
Persistent Memory
Maintain conversation context and system knowledge across sessions
FilteredMCPTools: The Foundation
The key innovation in this IBM i MCP implementation isFilteredMCPTools
, which extends agno’s standard MCPTools
class to filter available tools based on annotations. This allows creating specialized agents with access only to relevant toolsets.
How FilteredMCPTools Works
Annotation-Based Filtering
The MCP server attaches metadata annotations to each tool, including atoolsets
annotation that categorizes tools by domain. FilteredMCPTools leverages these annotations to create specialized agent experiences.
Available Toolsets
Based on the prebuilt configurations, the following toolsets are available:performance
: System performance monitoring, memory analysis, CPU metricssysadmin_discovery
: High-level system service discovery and categorizationsysadmin_browse
: Detailed browsing of system services by schema and typesysadmin_search
: Search capabilities for finding specific services and examples
Basic FilteredMCPTools Usage
Advanced Filtering Patterns
FilteredMCPTools supports sophisticated filtering strategies:Callable Filters
Combined Filters (AND logic)
Legacy Compatibility
IBM i Agent Patterns
Specialized Agents by Toolset
The existing agents in/agents/src/ibmi_agents/agents/
demonstrate four key patterns for IBM i system administration:
- Performance Agent
- Discovery Agent
- Browse Agent
- Search Agent
Toolset:
Focus: System performance monitoring and resource analysisAvailable Tools:
performance
Focus: System performance monitoring and resource analysis
system_status
, memory_pools
, temp_storage_buckets
, system_activity
, etc.Multi-Agent Operating System
The/agents/ibmi_agentos.py
example shows how to deploy multiple specialized agents using agno’s AgentOS
:
- Domain Expertise: Each agent specializes in specific IBM i domains
- Focused Tools: Agents only see relevant tools, improving performance and accuracy
- Parallel Operations: Users can interact with different agents simultaneously
- Modular Development: Easy to add new specialized agents for emerging needs
Advanced Agent Configuration
agno Agent Features for IBM i
The existing agents demonstrate key agno features optimized for IBM i environments:Persistent Memory and Context
Debug and Monitoring
Connection Management
IBM i agents require proper MCP connection handling with async context managers:Factory Pattern for Agent Creation
The existing code demonstrates a factory pattern for consistent agent creation:Testing and Development
Agent Evaluation Framework
The/agents/src/ibmi_agents/evals/
directory contains evaluation frameworks for testing agent reliability:
Development Environment Setup
The agents directory includes a complete development environment:Security and IBM i Integration
IBM i Authority Model Integration
IBM i agents should respect the system’s built-in authority model:Connection Security
The MCP server supports secure connections and authentication:Quick Start: Running Example Agents
Prerequisites
- Running MCP Server: Complete the Quick Start Guide
- Python Environment: Python 3.8+ with uv or pip
- Environment Configuration: IBM i connection details
Setup and Run
Web Interface
Both examples provide web interfaces where you can:- Chat with agents about IBM i system status
- Select specific agents for specialized tasks (in multi-agent mode)
- View tool calls and debug agent decision-making
- Access conversation history and agent memory
Future Framework Support
Coming Soon: Documentation for building IBM i agents using LangChain and LangGraph will be added to this guide in future releases. The FilteredMCPTools approach and toolset concepts will remain consistent across frameworks.
Best Practices for IBM i Agents
Toolset Design
Toolset Design
- Use FilteredMCPTools for all agents to limit scope and improve performance
- Match toolsets to agent purpose: performance agents get performance tools, etc.
- Combine MCP standard annotations (
readOnlyHint
,destructiveHint
) with custom toolsets - Enable debug filtering during development to understand tool selection
- Test filtering logic with different annotation combinations
agno Integration Patterns
agno Integration Patterns
- Use AgentOS for multi-agent deployments rather than single large agents
- Enable persistent memory (
enable_agentic_memory=True
) for context retention - Configure separate databases per agent type to avoid cross-contamination
- Use async context managers for proper MCP connection cleanup
- Leverage agno’s evaluation framework for testing agent reliability
IBM i Specialization
IBM i Specialization
- Include IBM i terminology in agent instructions (subsystems, authorities, objects)
- Explain tool choices - agents should say why they’re using specific tools
- Provide business context - relate technical metrics to operational impact
- Respect authority models - use read-only tools when appropriate
- Focus agents on specific domains rather than general-purpose system administration
Production Deployment
Production Deployment
- Use HTTPS for MCP connections in production environments
- Configure proper logging with agno’s debug modes and agent databases
- Implement health checks to monitor agent and MCP server connectivity
- Use appropriate model tiers (GPT-3.5-turbo for routine, GPT-4 for complex analysis)
- Monitor tool usage patterns to optimize toolset filtering
Next Steps
Quick Start
Set up your IBM i MCP server with proper toolsets
SQL Tools Building
Understand the underlying tools that power agent capabilities
Configuration
Learn about MCP server configuration and toolset organization
FilteredMCPTools Architecture: The key innovation is using annotation-based filtering to create specialized agents. Rather than building one large agent with access to all tools, create focused agents for specific IBM i domains. This improves performance, accuracy, and maintainability while providing clear separation of concerns for different administrative workflows.