๐ Agentic Corporate Simulation: A Cognitive Multi-Agent Framework
In a modern corporate landscape, decision-making often requires the intersection of various expertiseโStrategic, Human Resources, and Operational. This project builds an Agentic AI Ecosystem that simulates a professional board of directors.
Instead of a simple chatbot, this system implements a Cognitive Architecture where specialized AI Agents (CEO, CHRO, Manager) collaborate to solve business problems. By treating agents as modular tools and implementing a sophisticated memory management cycle, the framework ensures high-quality reasoning while maintaining efficiency in production environments.
This repository features a sophisticated Agentic AI System designed to simulate a corporate decision-making environment. It leverages a Supervisor-Worker architecture, served via FastAPI, and is fully containerized using Docker.
๐ 1. System Workflow: The Lifecycle of a Request
The system utilizes a LangGraph state machine to ensure logical consistency and context efficiency through a predefined execution path:
๐น Entry Point (Summarizer Node)
- Every user input is first processed by the Summarizer.
- If the thread history exceeds 10 messages:
- Older interactions are archived into a โProgressive Summaryโ.
- Only the 3 most recent messages are retained as raw context.
- This ensures the LLM receives a condensed yet relevant context window, preventing context overflow and maintaining focus.
๐น Routing (Orchestrator / Supervisor Node)
- The Orchestrator analyzes the user intent alongside the current summary.
- Acts as a router using LangChain Tool Calling to trigger specialized sub-agents:
call_ceoโ Strategycall_chroโ HR
๐น Execution (Worker Nodes)
- The selected Worker (CEO, CHRO, or Manager) receives refined context.
- Generates responses based on:
- Persona
- Business Goal (defined in YAML configurations)
๐น Persistence
- State is automatically saved to PostgreSQL via an asynchronous checkpointer.
- Enables stateful, long-running conversations across sessions.
๐ง 2. Intelligent Memory Management
๐น Short-Term Memory
- Managed via LangGraph State
- Tracks current conversation flow
๐น Progressive Memory
- The Summarizer Agent compresses historical data
- Maintains long-term context while optimizing token usage
๐น Stateful Persistence
- Powered by AsyncPostgresSaver
- Allows perfect restoration of any conversation thread
๐ ๏ธ 3. Tech Stack & Infrastructure
- Framework: LangChain (Prompt Templates, LLM interaction, Output Parsing)
- Orchestration: LangGraph (State Machine & cyclic workflows)
- Infrastructure: Docker & Docker Compose
- Backend: FastAPI (Async production-grade API)
- LLM Gateway: OpenRouter (gpt-oss-120b:free)
- Database: PostgreSQL (Async thread-state checkpointer)
๐ฎ 4. Future Roadmap: Towards a Cognitive Engine
๐น Modular Agent Toolsets
- Role-specific tools for enhanced capabilities
๐น Comprehensive Memory Model
- Semantic Memory: Vector-based retrieval using Qdrant
- Episodic Memory: Learning from past experiences
- Procedural Memory: Encoding business SOPs into graph logic
๐ Quick Start
๐น Prerequisites
Ensure you have Docker and Docker Compose installed.
๐น Step 1: Environment Configuration
Create a .env file in the root directory and add:
OPENROUTER_API_KEY=your_api_key_here
๐น Step 2: Build and Run
cd infra
docker-compose up --build -d
๐น Step 3: Access & Testing
Interactive API Docs: http://localhost:8000/docs Stopping the system:
docker-compose down
๐๏ธ 5. Database Management (pgAdmin)
๐น Connecting to the Database
| Field | Value |
|---|---|
| Host | db-persistence (or localhost if using host) |
| Port | 5432 |
| Maintenance Database | ai_memory |
| Username | user |
| Password | password |
๐ฎ 6. Extended Future Roadmap
๐น Modular Toolsets
- Financial analysis tools
- Market intelligence tools
๐น Cognitive Memory Tiers
-
Semantic Memory: Vectorized knowledge via Qdrant
-
Episodic Memory: Learning from historical interactions
-
Procedural Memory: Business SOPs embedded into graph logic
Project Structure
C:.
โ .gitignore
โ README.md
โ
โโโโbackend
โ โ .env
โ โ requirements.txt
โ โ
โ โโโโapp
โ โ โ main.py
โ โ โ
โ โ โโโโapi
โ โ โ โ deps.py
โ โ โ โ
โ โ โ โโโโroutes
โ โ โ โ chat.py
โ โ โ โ health.py
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ chat.cpython-311.pyc
โ โ โ
โ โ โโโโcore
โ โ โ config.py
โ โ โ logger.py
โ โ โ
โ โ โโโโschemas
โ โ โ โ agent.py
โ โ โ โ chat.py
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ chat.cpython-311.pyc
โ โ โ
โ โ โโโโ__pycache__
โ โ main.cpython-311.pyc
โ โ
โ โโโโengine
โ โ README.md
โ โ state.py
โ โ
โ โโโโagents
โ โ โ base.py
โ โ โ
โ โ โโโโceo
โ โ โ โ agent.py
โ โ โ โ config.yaml
โ โ โ โ prompt.txt
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ agent.cpython-311.pyc
โ โ โ
โ โ โโโโchro
โ โ โ โ agent.py
โ โ โ โ config.yaml
โ โ โ โ prompt.txt
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ agent.cpython-311.pyc
โ โ โ
โ โ โโโโmanager
โ โ โ โ agent.py
โ โ โ โ config.yaml
โ โ โ โ prompt.txt
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ agent.cpython-311.pyc
โ โ โ
โ โ โโโโorchestrator
โ โ โ โ agent.py
โ โ โ โ config.yaml
โ โ โ โ prompt.txt
โ โ โ โ routerDecision.py
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ agent.cpython-311.pyc
โ โ โ orchestrator.cpython-311.pyc
โ โ โ routerDecision.cpython-311.pyc
โ โ โ
โ โ โโโโSummarizerAgent
โ โ โ โ agent.py
โ โ โ โ config.yaml
โ โ โ โ prompt.txt
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ agent.cpython-311.pyc
โ โ โ
โ โ โโโโ__pycache__
โ โ base.cpython-311.pyc
โ โ
โ โโโโconfigs
โ โโโโllm
โ โ โ client.py
โ โ โ
โ โ โโโโproviders
โ โ โ โ groq.py
โ โ โ โ openRouter.py
โ โ โ โ
โ โ โ โโโโ__pycache__
โ โ โ groq.cpython-311.pyc
โ โ โ openRouter.cpython-311.pyc
โ โ โ
โ โ โโโโ__pycache__
โ โ client.cpython-311.pyc
โ โ
โ โโโโmemory
โ โ โ long_term.py
โ โ โ short_term.py
โ โ โ
โ โ โโโโ__pycache__
โ โ short_term.cpython-311.pyc
โ โ
โ โโโโorchestrator
โ โ โ orchestrator.py
โ โ โ router.py
โ โ โ
โ โ โโโโ__pycache__
โ โ orchestrator.cpython-311.pyc
โ โ
โ โโโโscripts
โ โโโโsupervisor
โ โโโโtests
โ โโโโtools
โ โ โ registry.py
โ โ โ
โ โ โโโโ__pycache__
โ โ registry.cpython-311.pyc
โ โ
โ โโโโ__pycache__
โ state.cpython-311.pyc
โ
โโโโfrontend
โโโโinfra
docker-compose.yml
Dockerfile.backend
Dockerfile.frontend