RSS Amplifier

sysid blog · Nov 2, 2019

Munggoggo: A modern message based async agent framework

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

An asyncio based agent platform written in Python and based on RabbitMQ. Agents are isolated processes which can host multiple parallel running behaviours implementing business logic and can be deployed as independent kubernetes pods. Access to the agent mesh is via REST/HTTP, websocket and jsonrpc. A few lines of code implement a fully fledged agent with a simple behaviour: sending and receiving…

An asyncio based agent platform written in Python and based on RabbitMQ.

Agents are isolated processes which can host multiple parallel running behaviours implementing business logic and can be deployed as independent kubernetes pods. Access to the agent mesh is via REST/HTTP, websocket and jsonrpc.

A few lines of code implement a fully fledged agent with a simple behaviour: sending and receiving ping messages to/from other agents.

from mode import Worker
from behaviour import Behaviour
from core import Core


class Agent(Core):
    class PingBehav(Behaviour):
        async def setup(self):
            self.counter = 0

        async def run(self):
            self.counter += 1
            msg = await self.receive()
            if msg:
                print(f"{self.name}: Message received: {msg.body.decode()}")
            await self.publish(str(self.counter), 'ping')
            await asyncio.sleep(0.9)

    async def setup(self) -> None:
        """ Register behaviour and subscribe to 'ping' topic """
        await self.add_runtime_dependency(self.PingBehav(self, binding_keys=['ping']))


if __name__ == '__main__':
    Worker(Agent(identity='AgentIdentity'), loglevel="info").execute_from_commandline()

Documentation: https://munggoggo.readthedocs.io/en/latest/
Github: https://github.com/sysid/munggoggo

Read on /munggoggo-a-modern-message-based-async-agent-framework/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.