Matrix-Alt-Core
Matrix-Alt-Core is a Matrix-themed Python framework that simplifies defining and running Agents. Agents are tasks that you can easily customize by overriding methods, with built-in support for parallel execution, logging, dynamic properties, and more.
Made by FRC Team 488 (Subteam: The Matrix), Matrix-Alt-Core provides the foundational tools for building complex, efficient agent-based systems.
✨ Features
- Define Agents: Create tasks by subclassing the
Agentclass and overriding core methods. - Parallel Execution: Easily run agents concurrently.
- Automatic Logging: Built-in logging system for task activity.
- Dynamic Properties: Seamlessly define and manage agent attributes.
- Minimal Boilerplate: Focus on your task's logic, while the framework handles the infrastructure.
📦 What’s Inside
Matrix-Alt-Core provides the core infrastructure for:
- Creating and managing Agents.
- Running tasks in parallel or sequentially.
- Tracking agent states and properties automatically.
- Integrating easily into larger systems (e.g., robotics, vision, localization).
🚀 Getting Started
To get started with Matrix-Alt-Core, install the package via pip:
pip install Matrix-Alt-Core
Then create your first agent:
from Alt.Core.Agents import Agent
class AgentExample(Agent):
"""
This example agent shows how simple it can be to create a task.
This agent creates a name property (which allows you to change its name),
and then it tells it to you 50 times before ending.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.nameProp = None
self.projectNameProp = None
self.timesRun = 0
def create(self):
""" Initialize the agent's properties. """
self.nameProp = self.propertyOperator.createProperty(
propertyTable="agent_name", propertyDefault="Bob"
)
self.projectNameProp = self.propertyOperator.createReadOnlyProperty(
propertyName="agent_name_readonly", propertyValue="bob"
)
self.timesRun = 0
def runPeriodic(self):
""" Periodic task loop. """
self.timesRun += 1
name = self.nameProp.get()
self.projectNameProp.set(name)
self.Sentinel.info(f"My name is {name}")
def onClose(self):
""" Cleanup when the task is closed. """
if self.nameProp is not None:
self.Sentinel.info(f"My time has come. Never forget the name {self.nameProp.get()}!")
def isRunning(self):
""" Condition to keep the task running. """
return self.timesRun < 50
def forceShutdown(self):
""" Force shutdown the task. """
self.Sentinel.info("Shutdown!")
def getDescription(self):
""" Return the task description. """
return "Agent_Example_Process"
def getIntervalMs(self):
""" Return the time interval between task runs. """
return 1000 # 1 second
if __name__ == "__main__":
from Alt.Core import Neo
n = Neo()
""" You can run as many agents as you have cpu cores
Here one agent runs in the background, and another runs on the main thread
"""
n.wakeAgent(AgentExample, isMainThread=False)
n.wakeAgent(AgentExample, isMainThread=True)
n.shutDown()
🛠 Project Origins
Matrix-Alt-Core was developed by FRC Team 488, under the subteam name The Matrix. The framework is designed for use in robotics and other complex systems, where tasks (or agents) need to be defined, executed, and managed efficiently in a multi-threaded or parallel environment. 📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for Matrix-Alt-Core 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| matrix_alt_core-0.0.1.tar.gz | 37.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matrix_alt_core-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.9 kB
Release files / matrix_alt_core-0.0.1.tar.gz
| Download URL | matrix_alt_core-0.0.1.tar.gz |
|---|---|
| Size | 37.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13d200874e783eef17811ba73a95b28385ee2a1c43eeb5b924e9202445f665b1
|
|
BLAKE2b-256 checksum How to use checksums |
6420b2636cc208cc7e6844ba7c00f33aa2f9791dd33031f2ffd5346ebc9c78bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / matrix_alt_core-0.0.1-py3-none-any.whl
| Download URL | matrix_alt_core-0.0.1-py3-none-any.whl |
|---|---|
| Size | 44.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f82bc0bf6a779702f1ed5a03fe6f8a13321f32ceba4110fb10fa927268fafb0
|
|
BLAKE2b-256 checksum How to use checksums |
28e03e803da6d3e4a8f3be1221391a8accd58a05f4123e0453a39a76dc4eef50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|