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.
Project description
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.
Project details
Release history Release notifications | RSS feed
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 matrix_alt_core-0.0.1.tar.gz.
File metadata
- Download URL: matrix_alt_core-0.0.1.tar.gz
- Upload date:
- Size: 37.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13d200874e783eef17811ba73a95b28385ee2a1c43eeb5b924e9202445f665b1
|
|
| MD5 |
fc0c3499d75b11177a1fd08e365e400d
|
|
| BLAKE2b-256 |
6420b2636cc208cc7e6844ba7c00f33aa2f9791dd33031f2ffd5346ebc9c78bb
|
File details
Details for the file matrix_alt_core-0.0.1-py3-none-any.whl.
File metadata
- Download URL: matrix_alt_core-0.0.1-py3-none-any.whl
- Upload date:
- Size: 44.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f82bc0bf6a779702f1ed5a03fe6f8a13321f32ceba4110fb10fa927268fafb0
|
|
| MD5 |
052b1940def06478cf287c9396619355
|
|
| BLAKE2b-256 |
28e03e803da6d3e4a8f3be1221391a8accd58a05f4123e0453a39a76dc4eef50
|