feat: pydantic models and inter-process messaging
Moved `InternalMessage` into schemas and created a `BeliefMessage` model. Also added the ability for agents to communicate via ZMQ to agents on another process. ref: N25B-316
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -39,7 +40,7 @@ async def test_agent_lifecycle():
|
||||
|
||||
# Wait for task to finish
|
||||
await asyncio.sleep(0.02)
|
||||
assert len(agent._tasks) == 1 # _process_inbox is still running
|
||||
assert len(agent._tasks) == 2 # message handling tasks are running
|
||||
|
||||
await agent.stop()
|
||||
assert agent._running is False
|
||||
@@ -51,14 +52,15 @@ async def test_agent_lifecycle():
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_unknown_agent(caplog):
|
||||
async def test_send_unknown_agent():
|
||||
agent = ConcreteTestAgent("sender")
|
||||
msg = InternalMessage(to="unknown_sender", sender="sender", body="boo")
|
||||
msg = InternalMessage(to="unknown_receiver", sender="sender", body="boo")
|
||||
|
||||
with caplog.at_level(logging.WARNING):
|
||||
await agent.send(msg)
|
||||
agent._internal_pub_socket = AsyncMock()
|
||||
|
||||
assert "Attempted to send message to unknown agent: unknown_sender" in caplog.text
|
||||
await agent.send(msg)
|
||||
|
||||
agent._internal_pub_socket.send_multipart.assert_called()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user