Agent Language Model (ALM) is a deterministic, policy-driven architecture for building robust AI agents. Unlike traditional LLM agents where the language model controls execution, ALM implements a Belief-Desire-Intention (BDI) state machine that treats the LLM as a cognitive tool, not a master.
pip install alm-coreThat's it! Package includes all core dependencies.
Clone and use one-command setup:
Linux/macOS:
git clone https://github.com/Jalendar10/alm-core.git
cd alm-core
chmod +x SETUP.sh && ./SETUP.shWindows:
git clone https://github.com/Jalendar10/alm-core.git
cd alm-core
SETUP.batThe setup script will automatically:
- β Verify Python 3.8+ installation
- β Create virtual environment
- β Install all dependencies
- β Configure environment files
- β Make scripts executable
Or install manually:
git clone https://github.com/Jalendar10/alm-core.git
cd alm-core
pip install -e .Hard constraints enforced programmatically, not through prompts.
rules = [
{"action": "delete_db", "allow": False},
{"action": "web_request", "forbidden_domains": ["malicious.com"]}
]
constitution = Constitution(rules)PII is sanitized before LLM inference and rehydrated afterward. The LLM provider never sees sensitive data.
airlock = DataAirlock()
sanitized = airlock.sanitize("My email is ceo@company.com")
# Output: "My email is <EMAIL_abc123>"The agent follows a BDI cycle where the controller decides what happens, using the LLM only for planning.
controller = ALMController(constitution, llm)
controller.set_goal("Research quantum computing")
result = controller.run_cycle()Real-time visualization of the agent's thought process.
visualizer = ExecutionVisualizer()
visualizer.export_graph("execution_map.png")pip install alm-coreFor full functionality (browser automation, visualization):
pip install alm-core[full]
playwright install chromium # For browser automationfrom alm_core import AgentLanguageModel
# Option 1: Use environment variables (recommended)
# export OPENAI_API_KEY="sk-..."
# export OPENAI_MODEL="gpt-4" # or gpt-3.5-turbo, gpt-4-turbo, etc.
agent = AgentLanguageModel(
rules=[
{"action": "delete_db", "allow": False},
{"action": "email_client", "forbidden_params": {"domain": "gmail.com"}}
]
)
# Option 2: Explicit configuration
agent = AgentLanguageModel(
api_key="sk-...",
model="gpt-3.5-turbo", # Any OpenAI or Anthropic model
rules=[{"action": "delete_db", "allow": False}]
)
# Process a task with automatic PII protection
response = agent.process("My email is ceo@company.com. Search for my last login.")
print(response)from alm_core import OmniAgent
# Configuration via dict (or use environment variables)
config = {
"model": "gpt-4", # Flexible: use any model you want
"rules": [{"action": "delete_db", "allow": False}],
"headless": False # Visual browser
}
with OmniAgent(config) as agent:
# Deep research with visualization
results = agent.deep_dive(
topic="Agent Language Models",
duration_minutes=5,
max_depth=3
)
# Autonomous web login (with user-in-the-loop for passwords)
agent.login_to_service("Gmail", "https://gmail.com")
# Export session data
agent.export_session("session_2024")alm_core/
βββ agent.py # Main orchestrators (AgentLanguageModel, OmniAgent)
βββ controller.py # BDI state machine
βββ memory.py # Data Airlock & Dual Memory
βββ policy.py # Constitutional Policy Engine
βββ llm_client.py # LLM provider abstraction
βββ visualizer.py # Execution graph visualization
βββ research.py # Deep recursive research
βββ tools/
βββ browser.py # Secure web automation
βββ desktop.py # OS/desktop control
- PII Protection: Automatic detection and sanitization of emails, phones, SSNs, credit cards
- Policy Enforcement: Hard constraints that cannot be bypassed by the LLM
- User-in-the-Loop: Critical operations (passwords, payments) require human confirmation
- Deep Research: Recursive knowledge acquisition with saturation detection
- Visual Thinking: See how the agent is reasoning, not just the output
- Multi-Modal: Web browsing, file system, command execution
- Multiple LLM Providers: OpenAI, Anthropic, local models (Ollama)
- Custom Tools: Easy integration of your own tools
- Execution History: Full audit trail of agent decisions
from alm_core import AgentLanguageModel
agent = AgentLanguageModel(openai_key="sk-...")
# The email is sanitized before going to OpenAI
response = agent.process(
"My SSN is 123-45-6789 and email is john@company.com. "
"Create a summary of my account."
)
# Response contains real data (rehydrated), but OpenAI never saw itfrom alm_core import AgentLanguageModel
from alm_core.policy import PolicyViolationError
rules = [
{"action": "file_write", "allowed_paths": ["/safe/dir"]},
{"action": "delete_db", "allow": False}
]
agent = AgentLanguageModel(openai_key="sk-...", rules=rules)
try:
# This will be blocked before execution
agent.process("Delete the production database")
except PolicyViolationError as e:
print(f"Action blocked: {e}")from alm_core import OmniAgent
with OmniAgent({"api_key": "sk-..."}) as agent:
research = agent.deep_dive(
topic="Quantum Computing Applications",
duration_minutes=10,
max_depth=4
)
print(research["summary"])
# Knowledge graph saved to quantum_computing_applications.pngfrom alm_core import AgentLanguageModel
def send_slack_message(channel: str, message: str) -> str:
# Your Slack integration
return f"Sent to {channel}: {message}"
agent = AgentLanguageModel(openai_key="sk-...")
agent.add_tool("send_slack", send_slack_message)
agent.process("Send a message to #engineering saying 'Deploy complete'")ALM is based on research into:
- BDI Architecture: Belief-Desire-Intention cognitive model
- Constitutional AI: Hard constraints vs. soft prompting
- Data Flow Security: Taint tracking and sanitization
- Agent Transparency: Visualizing agent reasoning
| Feature | Standard LLM Agent | ALM |
|---|---|---|
| Control Flow | LLM decides everything | Deterministic controller |
| Security | Prompt-based | Programmatic enforcement |
| PII Handling | Sent to LLM provider | Sanitized via Data Airlock |
| Transparency | Black box | Visual execution graph |
| Reliability | Prompt-dependent | State machine guarantees |
git clone https://github.com/yourusername/alm-core.git
cd alm-core
pip install -e ".[dev,full]"
playwright install chromiumpytest tests/ -v --cov=alm_coreblack alm_core/
flake8 alm_core/
mypy alm_core/# Build package
pip install build twine
python -m build
# Upload to PyPI
twine upload dist/*
# Install from PyPI
pip install alm-coreContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Research inspired by BDI architecture and Constitutional AI
- Built with support from the AI safety community
- Special thanks to contributors and early adopters
If you use ALM in your research, please cite:
@software{alm_core_2024,
title = {ALM Core: Agent Language Model Architecture},
author = {Maligireddy, Jalendar Reddy},
year = {2024},
url = {https://github.com/Jalendar10/alm-core}
}- Issues: GitHub Issues
- Email: jalendarreddy97@gmail.com
- Documentation: GitHub Repository
Built with β€οΈ for safer, more transparent AI agents