Journey Overview
Here’s a quick map of the stages and modules:Foundation
Your first chat agent using Agent, Backend, and Tool modules
Debugging
Add logging and monitoring to debug your agent’s behavior
Requirements
Add reasoning rules, guardrails, and user permissions
Knowledge
Ground your agent in data with RAG capabilities
Orchestration
Coordinate teams of specialized agents with Workflows
Production
Scale with caching and error handling
Integration
Expose agents as services (MCP, Agent Stack, A2A, IBM wxO)
Before You Start
- Python 3.11+
- BeeAI Framework:
pip install 'beeai-framework[wikipedia]' - Ollama running locally: Download Ollama
- Model downloaded:
ollama pull granite3.3
Foundation
Your First Agent
Let’s start with the simplest possible agent - one that can respond to messages.- Save as
simple_agent.py - Run
python simple_agent.py - Test different prompts
Ollama not responding?
Ollama not responding?
Verify it’s running:
Start the service:
ollama listStart the service:
ollama serveModel not found?
Model not found?
Pull the model:
List available models:
Create an alias: If your granite model doesn’t have the name
ollama pull granite3.3List available models:
ollama listCreate an alias: If your granite model doesn’t have the name
granite3.3 give it the alias by trying this command in your terminal ollama cp <existing model name> <alias>Import errors?
Import errors?
Update to the latest version:
Check Python version:
pip install --upgrade beeai-frameworkCheck Python version:
python --version (must be >= 3.11)Add Real-World Knowledge
Related Module: Tools
- “What’s the weather in different cities around the world?”
- “Tell me about quantum computing and the current weather in CERN’s location”
- “Compare the weather in New York and London, then tell me about their geographical similarity”
Debugging
Related Modules: Emitter, Events, Observability.
Framework Insights
The most simple way to see what’s happening in your application is by usingGlobalTrajectoryMiddleware which listens to all events and prints them to the console.
Catching events
Sometimes you want to react to specific events. To see which events are emitted, you can use theon function.
Logging
Relevant Module: Logger
Logger level of granularity and place logging statements at key points throughout your agent process.
OpenTelemetry / OpenInference
Logging to the console is great for development, but it’s not enough for production monitoring. You can easily let the framework send traces and metrics to external platforms like Arize Phoenix, LangFuse, LangSmith, and more.To run this step:
pip install openinference-instrumentation-beeai opentelemetry-sdk opentelemetry-exporter-otlpSet the Endpoint
Set theOTEL_EXPORTER_OTLP_ENDPOINT environment variable. Some vendors also need API kesy like OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer <token>
Enforce Rules with the RequirementAgent
Use requirements to control the agent’s behavior. Let’s add the ThinkTool and set up a ConditionalRequirement to enforce rules on when and how tools should be used.
Request User Permission with the AskPermissionRequirement
Add user permission for when you want an action to be human validated before being executed:
Knowledge
Now it’s time to integrate data. from a vector store using RAG (retrieval augmented generation)Relevant Module: RAG
Install the RAG extras (if you haven’t already):
Pull the
Create synthetic or non-synthetic Markdown files to ingest into your vector store.
pip install "beeai-framework[rag]" Pull the
nomic-embed-text model in Ollama. Create synthetic or non-synthetic Markdown files to ingest into your vector store.
Setup the Vector Store, Pre-process, and Load the Documents
- Create a new file and name it
step1_knowledge_base - Copy the following code into the file and replace the
file_pathswith your own files
Create RAG-Enabled Agent
- Create a new file that imports the helper functions from the
step1_knowledge_basefile and uses the vector store setup in the previous step - Copy the following code into a new file and replace the
file_pathswith your own paths
- Add some markdown files with information about your company/project
- Ask questions that should be answered from your documents
- Compare how responses differ with vs. without the knowledge base or when using different pre-processing strategies
Orchestration
Relevant Module: Workflows
Multi-Agent Hand-offs
Create a team of specialized agents that can collaborate:- Ask the coordinator mixed questions: “What’s the weather in Paris and tell me about its history?”
- Test how it decides which agent to use
- Try complex queries that need multiple specialists
Advanced Workflows
Production
Now it’s time for production-grade features.Caching for Speed & Efficiency
Relevant Module: Cache
Caching the entire agent isn’t practical—every agent run is usually unique. Instead, focus on caching the components inside your agent.
Handle Errors Gracefully
Relevant Module: Errors
Integration
Relevant Module: Serve, MCP, A2A, IBM watsonX Orchestrate
Model Context Protocol (MCP)
Expose your agent as an MCP server:Agent Stack
Expose your agent as a Agent Stack server:Agent2Agent (A2A) Protocol
Expose your agent as an A2A server:IBM watsonx Orchestrate
Expose your agent as an IBM watsonx Orchestrate server:What’s Next?
Congratulations! You’ve built a complete AI agent system from a simple chat bot to a production-ready, multi-agent workflow with knowledge bases, caching, error handling, and service endpoints. Each module page includes detailed guides, examples, and best practices. Here are some next steps:- Explore Modules: Dive deeper into specific modules that interest you
- Scale Your System: Add more agents, tools, and knowledge bases
- Custom Tools: Build your own tools for domain-specific functionality