Core execution engine for building AI agent applications — MicroAgent, AgentShell protocol, Cerebellum, and skill system
Project description
agentmatrix-core
Core execution engine for building AI agent applications.
Let LLMs think. Don't make them write JSON.
AgentMatrix separates reasoning from formatting. The large model thinks in natural language. A smaller model (Cerebellum) translates intent into executable parameters. Two models, each doing what they're best at.
Install
pip install agentmatrix-core
Requires Python 3.12+.
Architecture
┌─────────────────────────────────────────────┐
│ App Layer Your Application │
├─────────────────────────────────────────────┤
│ Shell Layer AgentShell Protocol │
│ (interface you implement) │
├─────────────────────────────────────────────┤
│ Core Layer MicroAgent Engine │
│ (this package) │
└─────────────────────────────────────────────┘
- Core Layer —
MicroAgentis the execution engine. Pure reasoning loop: think, detect actions, execute, repeat. No I/O, no UI. - Shell Layer —
AgentShellis the protocol you implement to connect Core to the outside world (LLM clients, prompt templates, session storage, etc.). - App Layer — Your application that wires everything together.
This separation means the same core agent behavior runs anywhere — desktop, terminal, or cloud.
Quick Start
1. Implement AgentShell
AgentShell is the interface between the Core engine and your application:
from agentmatrix.core.agent_shell import AgentShell
from agentmatrix.core.micro_agent import MicroAgent
class MyShell(AgentShell):
# Implement the required methods:
# - get_llm_client() → your LLM backend
# - get_system_prompt() → prompt template
# - get_session_store() → session persistence
# - on_action_result() → handle action outputs
# - on_agent_message() → handle agent responses
...
2. Create a MicroAgent and Run
agent = MicroAgent(
name="my-agent",
shell=my_shell,
skills=["file","web-search"],
)
# Start the reasoning loop
await agent.run("List files in the current directory")
3. See a Working Example
A complete terminal agent (~200 lines) is available in the repository:
git clone https://github.com/webdkt/agentmatrix.git
cd tutorial/cli-agent
export OPENAI_API_KEY=sk-xxx
python main.py -m https://endpoint-url:deepseek-v4-pro
Key Modules
| Module | Description |
|---|---|
core.micro_agent |
The execution engine — think, detect actions, execute, repeat |
core.agent_shell |
Shell protocol — implement this for your app |
core.cerebellum |
Intent-to-action parameter negotiation |
core.action |
Action registry and execution |
core.session_store |
Session persistence interface |
core.signals |
Event-driven communication (pause, resume, stop) |
Key Features
Natural Language Reasoning
The agent's "Brain" reasons entirely in natural language. No JSON output required, no format constraints. A separate "Cerebellum" translates intent into executable parameters.
Pause, Resume, Stop
Any running agent can be paused, resumed, or stopped via signals. State is preserved at safe checkpoints.
Context Auto-Compression
When conversation history grows too large, the system automatically compresses it into "Working Notes" — a dynamic state snapshot generated by the LLM. Tasks can run for hours; the context window never overflows.
Action System
Actions are detected from natural language output via <action_script> blocks. The Cerebellum negotiates parameters with the Brain, handles ambiguity, and executes.
Skill System
Built-in Python skill mixins:
- base — Date/time utilities
- file — File read/write, search
- shell — Shell command execution
Extend with custom Python skills or Markdown-based procedural knowledge.
Dependencies
pyyaml>=6.0python-dotenv>=1.0.0requests>=2.31.0aiohttp>=3.8.0
Links
- Repository: https://github.com/webdkt/agentmatrix
- Tutorial: tutorial/cli-agent/
- Documentation: docs/
- License: Apache License 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentmatrix_core-0.7.0.4.tar.gz.
File metadata
- Download URL: agentmatrix_core-0.7.0.4.tar.gz
- Upload date:
- Size: 82.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
521cfad9d17603e9596787d8e5e632b362025d212445b58c913b3050732e406c
|
|
| MD5 |
171b714faf0c3107e7f6150206cb5239
|
|
| BLAKE2b-256 |
4637eaee74d9baf1070c8dd92674df90e7e9ce56449fef8e79d0ffb3d55345b3
|
Provenance
The following attestation bundles were made for agentmatrix_core-0.7.0.4.tar.gz:
Publisher:
publish.yml on webdkt/agentmatrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmatrix_core-0.7.0.4.tar.gz -
Subject digest:
521cfad9d17603e9596787d8e5e632b362025d212445b58c913b3050732e406c - Sigstore transparency entry: 1458008766
- Sigstore integration time:
-
Permalink:
webdkt/agentmatrix@2632c28fe5368d4c04470f1d8e1e89a50afa2141 -
Branch / Tag:
refs/tags/v0.7.0.4 - Owner: https://github.com/webdkt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2632c28fe5368d4c04470f1d8e1e89a50afa2141 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentmatrix_core-0.7.0.4-py3-none-any.whl.
File metadata
- Download URL: agentmatrix_core-0.7.0.4-py3-none-any.whl
- Upload date:
- Size: 84.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b53463c72b06a4a16fec7b83b8d80c6d8065428a313f019d171f2b70522dadfb
|
|
| MD5 |
22d8baf5e64fb60e9f5ab84991838caa
|
|
| BLAKE2b-256 |
7a7b3c9f88ad1d6ea31e8b4d67e644d772f2cfd1906d173b2ec6a4e7f663b785
|
Provenance
The following attestation bundles were made for agentmatrix_core-0.7.0.4-py3-none-any.whl:
Publisher:
publish.yml on webdkt/agentmatrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmatrix_core-0.7.0.4-py3-none-any.whl -
Subject digest:
b53463c72b06a4a16fec7b83b8d80c6d8065428a313f019d171f2b70522dadfb - Sigstore transparency entry: 1458008870
- Sigstore integration time:
-
Permalink:
webdkt/agentmatrix@2632c28fe5368d4c04470f1d8e1e89a50afa2141 -
Branch / Tag:
refs/tags/v0.7.0.4 - Owner: https://github.com/webdkt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2632c28fe5368d4c04470f1d8e1e89a50afa2141 -
Trigger Event:
push
-
Statement type: