11# Abi Agent Module
22
3- > ** Multi-Agent Orchestrator and Strategic Advisory System**
3+ > ** Multi-Agent Orchestrator and Knowledge Graph Management System**
44
5- The Abi agent is the ** central coordinator ** for the ABI ecosystem, managing specialized AI agents and knowledge graph operations while providing strategic advisory capabilities.
5+ The Abi module is the ** central coordination hub ** for the ABI ecosystem, featuring a sophisticated multi-agent orchestrator, specialized knowledge graph agents, and comprehensive ontology management capabilities.
66
77## 🎯 Purpose & Role
88
9- ** Abi** (* Agentic Brain Infrastructure* ) orchestrates multi-agent workflows by :
9+ ** Abi** (* Agentic Brain Infrastructure* ) provides comprehensive AI orchestration and knowledge management through :
1010
11- - ** Coordinating ** specialized AI agents (ChatGPT, Claude, Mistral, Gemini, Grok, Llama, Perplexity)
12- - ** Managing ** conversation context and agent transitions
13- - ** Routing ** requests based on weighted decision hierarchy
14- - ** Providing ** strategic advisory through direct consultation
15- - ** Supporting ** multilingual interactions (English/French)
16- - ** Integrating ** knowledge graph exploration and SPARQL querying
11+ - ** Multi-Agent Orchestration ** : Central coordinator managing specialized AI agents (ChatGPT, Claude, Mistral, Gemini, Grok, Llama, Perplexity, Qwen, DeepSeek, Gemma )
12+ - ** Knowledge Graph Operations ** : Complete CRUD operations for semantic data management
13+ - ** Ontology Engineering ** : BFO-compliant entity extraction and SPARQL generation
14+ - ** Intelligent Routing ** : Weighted decision hierarchy with context preservation
15+ - ** Multilingual Support ** : Native French/English interactions with cultural awareness
16+ - ** Production Integration ** : Event-driven triggers and YAML ontology publishing
1717
1818## 🏗️ Architecture
1919
2020### Directory Structure
2121```
2222src/core/modules/abi/
2323├── agents/ # Agent implementations
24- │ ├── AbiAgent.py # Main orchestrator
25- │ ├── AbiAgent_test.py # Test suite
26- │ ├── EntitytoSPARQLAgent.py
27- │ ├── KnowledgeGraphBuilderAgent.py
28- │ └── OntologyEngineerAgent.py
24+ │ ├── AbiAgent.py # Main multi-agent orchestrator
25+ │ ├── AbiAgent_test.py # Comprehensive test suite
26+ │ ├── EntitytoSPARQLAgent.py # BFO entity extraction & SPARQL generation
27+ │ ├── EntitytoSPARQLAgent_test.py # Entity extraction tests
28+ │ ├── KnowledgeGraphBuilderAgent.py # Triple store CRUD operations
29+ │ ├── KnowledgeGraphBuilderAgent_test.py # KG builder tests
30+ │ ├── OntologyEngineerAgent.py # BFO ontology engineering
31+ │ └── OntologyEngineerAgent_test.py # Ontology engineering tests
2932├── models/ # Model configurations
30- │ ├── o3_mini.py # OpenAI o3-mini (cloud)
31- │ └── qwen3_8b.py # Qwen3 8B (local/Ollama)
32- ├── workflows/ # Business logic workflows
33- ├── pipelines/ # Data processing pipelines
34- ├── ontologies/ # Ontology definitions
35- ├── sandbox/ # Experimental scripts
36- ├── triggers.py # Event-driven triggers
37- ├── mappings.py # Visualization mappings
33+ │ ├── o3_mini.py # OpenAI o3-mini (cloud, temp=1.0)
34+ │ └── qwen3_8b.py # Qwen3 8B (local/Ollama, temp=0.7)
35+ ├── workflows/ # Business logic workflows (15 implementations)
36+ │ ├── AgentRecommendationWorkflow.py # AI agent recommendation engine
37+ │ ├── ConvertOntologyGraphToYamlWorkflow.py # Graph to YAML conversion
38+ │ ├── CreateClassOntologyYamlWorkflow.py # Class ontology publishing
39+ │ ├── CreateIndividualOntologyYamlWorkflow.py # Individual ontology publishing
40+ │ ├── ExportGraphInstancesToExcelWorkflow.py # Data export capabilities
41+ │ ├── GetObjectPropertiesFromClassWorkflow.py # Property retrieval
42+ │ ├── GetSubjectGraphWorkflow.py # Entity graph exploration
43+ │ ├── SearchIndividualWorkflow.py # Semantic search
44+ │ └── TemplatableSparqlQuery.py # SPARQL query templating
45+ ├── pipelines/ # Data processing pipelines (18 implementations)
46+ │ ├── AddIndividualPipeline.py # Entity creation
47+ │ ├── InsertDataSPARQLPipeline.py # SPARQL data insertion
48+ │ ├── MergeIndividualsPipeline.py # Entity merging
49+ │ ├── RemoveIndividualPipeline.py # Entity deletion
50+ │ ├── UpdateDataPropertyPipeline.py # Property updates
51+ │ └── Update*Pipeline.py # Specialized update pipelines
52+ ├── ontologies/ # Ontology definitions (4-level hierarchy)
53+ │ ├── top-level/ # BFO foundational ontologies
54+ │ ├── mid-level/ # Common Core Ontologies
55+ │ ├── domain-level/ # Domain-specific ontologies
56+ │ └── application-level/ # Use-case specific ontologies
57+ ├── sandbox/ # Experimental scripts (8 utilities)
58+ ├── triggers.py # Production event-driven triggers
59+ ├── mappings.py # Knowledge graph visualization colors
3860└── __init__.py # Module initialization
3961```
4062
@@ -65,23 +87,31 @@ graph TD
6587| Variable | Values | Default | Description |
6688| ----------| --------| ---------| -------------|
6789| ` AI_MODE ` | ` cloud ` \| ` local ` | ` cloud ` | Model deployment mode |
68- | ` OPENAI_API_KEY ` | API key | Required | For cloud model (o3-mini) |
69- | ` NAAS_API_KEY ` | API key | Optional | For production ontology triggers |
90+ | ` OPENAI_API_KEY ` | API key | Required | For cloud models (o3-mini, gpt-4o) |
91+ | ` NAAS_API_KEY ` | API key | Optional | For production ontology triggers & YAML publishing |
92+ | ` ENV ` | ` dev ` \| ` prod ` | ` dev ` | Environment mode (affects trigger activation) |
7093
7194### Model Selection
7295
7396The agent automatically selects models based on ` AI_MODE ` :
7497
7598``` python
76- # Cloud Mode (default)
99+ # Cloud Mode (default) - Creative orchestration
77100AI_MODE = cloud # Uses OpenAI o3-mini with temperature=1.0
78101
79- # Local Mode
102+ # Local Mode - Privacy-focused with stable performance
80103AI_MODE = local # Uses Ollama qwen3:8b with temperature=0.7
81104
82- # Error handling
105+ # Model Selection Logic:
106+ # - AbiAgent: Uses AI_MODE selection (o3-mini vs qwen3:8b)
107+ # - EntitytoSPARQLAgent: Uses o3-mini (cloud only)
108+ # - KnowledgeGraphBuilderAgent: Uses gpt-4o (cloud only)
109+ # - OntologyEngineerAgent: Uses o3-mini (cloud only)
110+
111+ # Error Handling:
83112# Missing OPENAI_API_KEY in cloud mode → Agent creation fails
84- # Missing Ollama in local mode → Agent creation fails
113+ # Missing Ollama in local mode → AbiAgent creation fails
114+ # Specialized agents require cloud mode and OpenAI API key
85115```
86116
87117## 🚀 Usage
@@ -92,32 +122,32 @@ AI_MODE=local # Uses Ollama qwen3:8b with temperature=0.7
92122# Start Abi agent (default target)
93123make chat-abi-agent
94124
95- # Explicit cloud mode
96- AI_MODE=cloud make chat-abi-agent
97-
98- # Local privacy mode (requires Ollama)
99- AI_MODE=local make chat-abi-agent
100-
101- # Alternative generic agent runner
102- make chat agent=AbiAgent
125+ # Alternative agent runners
126+ make chat agent=AbiAgent # Multi-agent orchestrator
127+ make chat agent=EntitytoSPARQLAgent # Entity extraction & SPARQL
128+ make chat agent=KnowledgeGraphBuilderAgent # Knowledge graph operations
129+ make chat agent=OntologyEngineerAgent # BFO ontology engineering
103130```
104131
105132### Programmatic Integration
106133
107134``` python
108135from src.core.modules.abi.agents.AbiAgent import create_agent
136+ from src.core.modules.abi.agents.EntitytoSPARQLAgent import create_agent as create_entity_agent
137+ from src.core.modules.abi.agents.KnowledgeGraphBuilderAgent import create_agent as create_kg_agent
109138
110- # Create agent with automatic model selection
111- agent = create_agent()
139+ # Create orchestrator with automatic model selection
140+ abi_agent = create_agent()
141+ response = abi_agent.invoke(" Route this to the best AI for code generation" )
142+ # Workflow: Context preservation → Classification → Weighted routing to Mistral
112143
113- # Direct interaction
114- response = agent.invoke(" Route this to the best AI for code generation" )
144+ # Knowledge graph operations
145+ kg_agent = create_kg_agent()
146+ kg_agent.invoke(" Add a new organization called 'NaasAI' to the knowledge graph" )
115147
116- # Workflow:
117- # 1. Context preservation check
118- # 2. Request classification (code generation)
119- # 3. Weighted routing to Mistral
120- # 4. Response synthesis with "Abi:" prefix
148+ # Entity extraction and SPARQL generation
149+ entity_agent = create_entity_agent()
150+ entity_agent.invoke(" Extract entities from: 'John works at Microsoft as a software engineer'" )
121151```
122152
123153### Interaction Patterns
0 commit comments