Skip to main content

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 Agent class 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matrix_alt_core-0.0.1.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matrix_alt_core-0.0.1-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

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

Hashes for matrix_alt_core-0.0.1.tar.gz
Algorithm Hash digest
SHA256 13d200874e783eef17811ba73a95b28385ee2a1c43eeb5b924e9202445f665b1
MD5 fc0c3499d75b11177a1fd08e365e400d
BLAKE2b-256 6420b2636cc208cc7e6844ba7c00f33aa2f9791dd33031f2ffd5346ebc9c78bb

See more details on using hashes here.

File details

Details for the file matrix_alt_core-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for matrix_alt_core-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f82bc0bf6a779702f1ed5a03fe6f8a13321f32ceba4110fb10fa927268fafb0
MD5 052b1940def06478cf287c9396619355
BLAKE2b-256 28e03e803da6d3e4a8f3be1221391a8accd58a05f4123e0453a39a76dc4eef50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page