No project description provided
Project description
RAKUN: A Rust-Python Multi-Agent System Framework with Plugable Communication
RAKUN is a robust multi-agent system framework developed with the Python programming language, fused with the efficiency and safety of Rust via the PyO3 project. This unique combination ensures high performance and superior safety standards for your Python development projects.
One of the core strengths of RAKUN is its pluggable communication feature. This means the framework is designed to work with various communication protocols, based on user requirements. Its built-in libp2p integration facilitates peer-to-peer (P2P) communication between agents, making the system highly decentralized and scalable. However, should the project requirements change, the communication protocol can be easily swapped out to match your specific needs, removing the dependency on a specific third-party message-passing library. This flexibility is what sets RAKUN apart and ensures the framework can adapt to a wide range of scenarios.
Overview
In the RAKUN framework, an agent is defined as a discrete unit that independently performs tasks in an asynchronous
manner while communicating with its fellow agents. These agents are constructed as Python classes, encapsulating the
specific actions and behaviors they're responsible for. The orchestration of these agents, including their lifecycle
management and communication handling, is overseen by a specialized component known as the AgentManager
. This means
the AgentManager
is responsible for initiating, supervising, and terminating the agents, as well as facilitating their
interactions.
Key Features
-
Rust-PyO3 Bridge: The framework amalgamates the robustness and speed of Rust with Python's versatility and simplicity through the PyO3 interface. This innovative blend allows developers to leverage the strengths of both languages.
-
Pluggable Communication: While it natively incorporates the libp2p library for decentralized, peer-to-peer communication among agents, it also supports the flexibility to plug-in different communication protocols as per project requirements, ensuring a scalable and resilient networking setup.
-
Asynchronous Operations: RAKUN enables defining and handling of asynchronous tasks, thereby significantly enhancing the system's performance and responsiveness.
-
Modular Design: RAKUN's agent-centric model fosters a modular approach, encouraging the development of reusable and maintainable code segments.
Usage
RAKUN's potential can be best understood through real-world applications. Consider the design of an advanced smart home system. In this scenario, multiple agents can each manage a unique aspect of the smart home.
-
TemperatureAgent: Monitors the ambient temperature and communicates with other agents to ensure the home stays comfortable. For instance, if the temperature rises above a certain level, the TemperatureAgent could send a signal to the AirConditioningAgent.
-
AirConditioningAgent: Receives signals from the TemperatureAgent or HumidityAgent and accordingly controls the air conditioning system to maintain optimal conditions.
-
LightingAgent: Responds to light conditions outside and within the home, time of the day, or direct instructions from the homeowner, and communicates with individual LightAgents.
-
LightAgent: Each light in the home could be managed by its own agent, taking instructions from the LightingAgent to dim, brighten, switch on, or switch off.
-
SecurityAgent: Manages the overall security of the home, communicating with DoorAgents and WindowAgents to ensure the home is secure.
-
DoorAgent and WindowAgent: Monitor the status of each door and window, respectively, sending status updates to the SecurityAgent.
In this multi-agent setup, each agent independently manages its assigned task, but through effective communication, they operate collectively as an intelligent smart home system. This is just one example of how RAKUN can be used. The framework is versatile enough to support a broad range of scenarios and use cases, from managing infrastructure systems to coordinating activities in a warehouse or factory.
Defining an Agent
Each agent is a Python class where you define the tasks that the agent should perform. The @Processor
decorator is
used to associate an event type that triggers a function.
class EchoAgent:
def __init__(self, name):
self.name = name
self.count = 0
@Processor(event_type=EventType.OnBoot)
async def on_start(self):
while True:
self.count += 1
await asyncio.sleep(1)
print(f"{self.name} on_start")
Registering and Running Agents
After defining the agents, they are registered with the AgentManager
, which manages their execution and communication.
if __name__ == "__main__":
echo_agent = EchoAgent("EchoAgent")
greeting_agent = GreetingAgent("GreetingAgent")
agent_manager = AgentManager()
agent_manager.register(greeting_agent, 1)
agent_manager.register(echo_agent, 2)
agent_manager.start()
Inter-Agent Communication
For communication, the framework leverages libp2p for inter-agent messaging. Agents can publish messages using
the publish
method, which are then propagated to other agents. The messages can be any byte or bytearray type, making
it possible to send a variety of data types and structures.
await self.publisher.publish(byte_message)
Conclusion
The rk_core framework opens up new avenues for efficient, scalable, and robust multi-agent system development in Python. With the powerful combination of Rust and PyO3 at its core and the decentralized communication capabilities offered by libp2p, rk_core stands out from traditional Python-based agent frameworks. Whether designing a small system with few agents or a large-scale complex multi-agent system, rk_core offers the flexibility and performance you need.
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 Distributions
Built Distributions
File details
Details for the file rk_core-0.1.14-cp311-none-win_amd64.whl
.
File metadata
- Download URL: rk_core-0.1.14-cp311-none-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 987a81ae2cf629126740fc027e988434a0825f995d7c936613c56d31a8caf62f |
|
MD5 | b9496a7320711730c4c011972d5378ae |
|
BLAKE2b-256 | 251aa1610de794153f3a36ee900f597d4f9765815b7c215073ef73bad12cb021 |
File details
Details for the file rk_core-0.1.14-cp310-none-win_amd64.whl
.
File metadata
- Download URL: rk_core-0.1.14-cp310-none-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce65fe7a4c78600b9930884fbe7ab7e577970810e3702790c60534e9fee30dbc |
|
MD5 | 1b0009e554b35b7e4fb3bc3d597548d3 |
|
BLAKE2b-256 | 85b7de0b99dc19f06472652f6c67ddf02bf2df1741367a599a2544cdf47dea73 |
File details
Details for the file rk_core-0.1.14-cp39-none-win_amd64.whl
.
File metadata
- Download URL: rk_core-0.1.14-cp39-none-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 156eef63d43a1173c0946c1f886ac8905d0ff433b286d4173882bc4508e04d1c |
|
MD5 | 622d99ef5307978235709cdfed5b13bf |
|
BLAKE2b-256 | 3b696a81c2c208235c31d644d28a2ee2e47066d0671d64bf0820a37957917ac7 |
File details
Details for the file rk_core-0.1.14-cp38-none-win_amd64.whl
.
File metadata
- Download URL: rk_core-0.1.14-cp38-none-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa444e9bc0e649a2ad3738e0f8b571783bcd1bb5b449792f3ea55aaadb5e4948 |
|
MD5 | 09ae23e3fd7d201ebf8fc649a6c5184d |
|
BLAKE2b-256 | d31f0f5de519ab286551c8e284163b6de6a6d3b35623e6bdb0e91564c24cec22 |
File details
Details for the file rk_core-0.1.14-cp37-none-win_amd64.whl
.
File metadata
- Download URL: rk_core-0.1.14-cp37-none-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.7, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48758aa6d0ac9094054af131f5b54df4cf2c443a4cf50a2cf573c1245d7d4094 |
|
MD5 | e566af6b6a42b35aeba9554a4f586d33 |
|
BLAKE2b-256 | 8e01f20cc9d426fceef7818b3910f41a09d8a406dd194333f1a9ac71a32045bc |