AGEL-Comp is a novel neuro-symbolic architecture designed to address a critical limitation of Large Language Model (LLM)-based agents: compositional generalizationβthe ability to understand and produce novel combinations of known, primitive components.
LLM-powered agents exhibit systemic failures when facing compositional challenges. They rely on statistical pattern matching rather than structured, causal understanding of the world. AGEL-Comp bridges this gap by combining:
- Symbolic Reasoning - Explicit, interpretable world models
- Neural Flexibility - Adaptive LLM-based planning
- Empirical Grounding - Learning from interaction in simulated environments
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AGEL-Comp Agent β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β β Perception βββββββΆβ LLM Core ββββββββ Feedback β β
β β Module β β β β Signals β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββ β
β β Hybrid Planner β β
β β + Verifier β β
β βββββββββββββββββββ β
β β β β
β ββββββββββββββββ ββββββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββββ β
β β LLM Planner β β NTP Verifier β β
β β (Generative) β β (Symbolic) β β
β ββββββββββββββββ ββββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β βCausal Programβ β Episodic β β Grounding β β
β βGraph (CPG) ββββββββ Memory ββββββββ Function β β
β β (World Model)β β β β (ILP) β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Translates raw environment state into structured percepts
- Ground literals representing entities and their states
- Feeds into LLM context
- Directed hypergraph representation of procedural and causal knowledge
- Nodes: Grounded predicates (e.g.,
is_harmful(X),fire) - Hyperedges: Horn clauses functioning as sub-programs
- Supports hierarchical planning and targeted model revision
- LLM as Planner: Generates candidate sub-goals from percepts and goals
- Neural Theorem Prover (NTP) as Verifier: Validates logical soundness
- Bridges creative generation with symbolic rigor
Two-stage grounding process:
- Causal Attribution: Solves credit assignment problem for prediction errors
- Abstractive Induction: Generalizes specific observations into reusable Horn clauses
- Transforms raw experience into symbolic rules
- Fixed-size buffer storing recent experiences
- Each experience:
(State, Action, Feedback)tuple - Provides data for continuous learning
- Translates high-level textual plans into executable commands
- Direct interface with simulation environment API
- Unity 2022.3 LTS or later
- C# 10.0 or later
- .NET Framework 4.7.1+
- Python 3.8+ (for analysis scripts)
-
Clone the repository
git clone https://github.com/yourusername/ActionRPG-Quest-System.git cd ActionRPG-Quest-System/ActionRPG-Quest-System -
Install dependencies
# Install required Unity packages via Package Manager # Navigate to: Window > TextMesh Pro > Import TMP Essential Resources
-
Configure API Keys (see API Configuration Guide)
# Copy the template cp .env.example .env # Edit with your API keys (DO NOT commit .env!)
-
Open in Unity
- File > Open Project
- Select the
ActionRPG-Quest-Systemfolder
- Open the main scene:
Assets/Scenes/MainScene.unity - Attach
AGELAgentto the player GameObject - Configure experiment parameters in the Inspector
- Press Play to start the agent
// Use AGELExperimentManager for batch processing
AGELExperimentManager manager = GetComponent<AGELExperimentManager>();
manager.RunExperiment(config);unity -projectPath . -batchmode -executeMethod AGELExperiment.RunBatch -nographicsvar config = new LLMConfiguration(
name: "GPT-4o",
modelName: "gpt-4o",
temperature: 0.7f,
useNTP: true,
useILP: true,
ntpThreshold: 0.7f
);// Use different models for planning vs verification
var plannerConfig = new LLMConfiguration("gpt-4o", "gpt-4o", 0.9f);
var verifierConfig = new LLMConfiguration("gpt-4-turbo", "gpt-4-turbo", 0.2f);The Retro Quest environment is a custom 2D RPG simulation designed to systematically probe compositional generalization.
- Grid-based world with dynamic entities
- Rich action space (movement, interaction, combat, dialogue)
- Compositional goal structure enabling systematic evaluation
- Feedback signals encoding outcome intensity and content
| Scenario | Focus | Metrics |
|---|---|---|
| Basic Composition | Combining primitive actions | Success rate, plan length |
| Hierarchical Goals | Multi-step sub-goal decomposition | Depth accuracy, completeness |
| Novel Combinations | Zero-shot compositional transfer | Generalization gap, performance |
| Adversarial Perturbations | Robustness to world model changes | Adaptation speed, error recovery |
// See: Assets/Scripts/AGEL_Experiments/AGELQuestExperiment.cs
AGELQuestExperiment experiment = new AGELQuestExperiment();
experiment.RunCompositionBenchmark();
experiment.EvaluateSystematicity();
experiment.EvaluateProductivity();- Compositional Systematicity: AGEL-Comp achieves >85% success on novel goal combinations
- Sample Efficiency: Learns interpretable rules from ~10 examples per rule
- Robustness: Maintains >90% performance after adversarial world model perturbations
- Interpretability: Generated rules are human-readable and logically sound
- Pure LLM: ~45% on novel compositions (fails due to distribution shift)
- Pure ILP: ~60% on novel compositions (limited by symbolic expressiveness)
- AGEL-Comp: ~85% on novel compositions (synergistic neuro-symbolic approach)
- Detailed results:
comprehensive_results/ - Rule database:
comprehensive_results/cpg_rules_database.csv - Evolution analysis:
comprehensive_results/cpg_evolution/ - Visualizations:
comprehensive_results/plots/
The codebase includes integrations with:
- OpenAI GPT-4o:
Assets/Scripts/AGEL/Multimodal/GPT4oClient.cs - Google Gemini 2.5 Pro:
Assets/Scripts/AGEL/Multimodal/GeminiClient.cs - DeepSeek VL:
Assets/Scripts/AGEL/Multimodal/DeepSeekVLClient.cs - Ollama (Local):
Assets/Scripts/AGEL/OllamaClient.cs - PostHog Analytics:
Assets/Scripts/AGEL/OllamaClient.cs(optional telemetry)
DO NOT:
- β Commit
.env,config.json, or any files with API keys - β Hardcode API keys in scripts
- β Share API keys in issues or pull requests
DO:
- β Use environment variables (see .env.example)
- β Configure keys in Unity Inspector (runtime only, not saved to repo)
- β Follow the Security Guide
- β Review API Configuration for proper setup
# 1. Copy template
cp .env.example .env
# 2. Add your keys (this file is in .gitignore)
# OPENAI_API_KEY=sk-...
# GEMINI_API_KEY=...
# DEEPSEEK_API_KEY=...
# 3. In Unity, load from environment:
string apiKey = System.Environment.GetEnvironmentVariable("OPENAI_API_KEY");See API Configuration Guide for full setup instructions.
ActionRPG-Quest-System/
βββ Assets/
β βββ AGEL_Experiments/ # Experiment managers and configurations
β β βββ AGELExperimentManager.cs
β β βββ AGELQuestExperiment.cs
β β βββ LLMConfiguration.cs
β βββ Scripts/
β β βββ AGEL/ # Core AGEL-Comp framework
β β β βββ OllamaClient.cs
β β β βββ NeuralTheoremProver.cs
β β β βββ CausalProgramGraph.cs
β β β βββ Multimodal/
β β β βββ BaseModelClient.cs
β β β βββ GPT4oClient.cs
β β β βββ GeminiClient.cs
β β β βββ DeepSeekVLClient.cs
β β βββ PlayerScripts/ # Player/agent control
β β βββ QuestSystem/ # Quest management
β β βββ Enemy/ # Enemy AI
β β βββ NPC Scripts/ # NPC interactions
β βββ Scenes/
β βββ Prefabs/
β βββ Sprites/
βββ comprehensive_results/ # Experimental results & analysis
β βββ cpg_rules_database.csv
β βββ cpg_evolution/
β βββ plots/
β βββ summary/
βββ Packages/ # Dependencies
βββ ProjectSettings/ # Unity project settings
βββ ActionSpace.csv # Available agent actions
βββ Feedbacks.csv # Feedback taxonomy
βββ paper.txt # Research paper (IntelliSys 2026)
βββ .env.example # API key template
βββ .gitignore # Version control exclusions
βββ README.md # This file
- CausalProgramGraph.cs - World model as directed hypergraph
- NeuralTheoremProver.cs - Differentiable logical verification
- AGELAgent.cs - Main agent implementation (deduction-abduction cycle)
- BaseModelClient.cs - Abstract base for all model clients
- GPT4oClient.cs - OpenAI integration
- GeminiClient.cs - Google Gemini integration
- AGELQuestExperiment.cs - Main experiment harness
- AGELExperimentManager.cs - Batch experiment runner
- LLMConfiguration.cs - Configuration system
- Create a client inheriting from
BaseModelClient:
[CreateAssetMenu(menuName = "AGEL/Model Clients/My Model")]
public class MyModelClient : BaseModelClient
{
public override ModelType ModelType => ModelType.MyModel;
public override IEnumerator Initialize() { /* ... */ }
protected override object PrepareRequestData(...) { /* ... */ }
protected override UnityWebRequest CreateRequest(string jsonPayload) { /* ... */ }
protected override ModelResponse ProcessResponse(string jsonResponse) { /* ... */ }
}- Register in MultimodalManager:
modelClients[ModelType.MyModel] = myModelClientInstance;- Use in your agent:
yield return multimodalManager.GenerateResponse(
messages,
response => { /* handle response */ },
ModelType.MyModel
);The Grounding Function (ILP engine) is the core of compositional learning. To extend it:
- See
Assets/Scripts/AGEL/InductiveLogicProgramming.cs - Implement custom horn clause generation strategies
- Test with
AGELQuestExperiment.RunLearningCycle()
If you use AGEL-Comp in your research, please cite:
@article{shahid2026agelcomp,
title={AGEL-Comp: A Neuro-Symbolic Framework for Compositional Generalization in Embodied Agents},
author={Shahid, Mahnoor and Rothe, Hannes},
booktitle={12th Intelligent Systems Conference 2026},
pages={},
year={2026},
organization={IntelliSys 2026}
}The full research paper is available at:
Conference: IntelliSys 2026 (12th Intelligent Systems Conference 2026)
Location: Paphos, Cyprus
Dates: May 25-29, 2026
- Follow existing code style (C# 10 conventions)
- Add unit tests for new components
- Update documentation for architectural changes
- Use meaningful commit messages
Please include:
- Environment details (Unity version, OS)
- Minimal reproduction steps
- Expected vs. actual behavior
- Relevant configuration files (sanitized of API keys!)
Authors:
- Mahnoor Shahid (mahnoor.shahid@uni-due.de)
- Hannes Rothe (hannes.rothe@uni-due.de)
Institution: UniversitΓ€t Duisburg-Essen, Germany
This research code is provided for academic and research purposes. See LICENSE file for details.
Run a single experiment:
# In Unity Editor: Click Play with AGELExperimentManager configuredEvaluate compositional generalization:
var results = experiment.EvaluateCompositionality(testGoals);
Debug.Log($"Systematicity: {results.systematicity}%");
Debug.Log($"Productivity: {results.productivity}%");Inspect learned rules:
var cpg = agent.GetWorldModel();
foreach (var rule in cpg.GetAllRules())
{
Debug.Log($"Learned: {rule.head} :- {string.Join(", ", rule.body)}");
}Configure LLM model:
// In Unity Inspector:
// 1. Select MultimodalManager asset
// 2. Set Active Model Type
// 3. Configure API key for selected model
// 4. Test with "Initialize" button| Issue | Solution |
|---|---|
| API Key Error | Check API_CONFIGURATION.md & environment variables |
| NTP Timeouts | Increase timeout in BaseModelClient; reduce proof search depth |
| Memory Issues | Reduce episodic memory buffer size; process batches separately |
| No Rules Learned | Increase feedback signal intensity; check ILP threshold parameters |
Last Updated: February 2, 2026
Status: Ready for publication with AAMAS 2026