Skip to content

Commit

Permalink
fix minor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dewmal committed Jan 23, 2025
1 parent 8679d0f commit d318e25
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bindings/ceylon/examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
from ceylon import AgentDetail
from ceylon.base.agents import Worker, Admin

ag = Admin(name="admin", port=8888, role="admin")
ag_w = Worker(name="worker_agent1", role="worker1")
ag_w1 = Worker(name="worker_agent2", role="worker_2")
import asyncio


@dataclass
class BaseData:
name: str


ag = Admin(name="admin", port=8888, role="admin")
ag_w = Worker(name="worker_agent1", role="worker1")
ag_w1 = Worker(name="worker_agent2", role="worker_2")


@ag.on(BaseData)
async def on_message(agent_id: str, data: BaseData, time: int) -> None:
print(f"Received message from {agent_id}: {data} at {time}")
Expand All @@ -41,6 +44,4 @@ async def on_connect_admin2(topic: str, agent: AgentDetail):


if __name__ == '__main__':
import asyncio

asyncio.run(ag.start_agent(b"", [ag_w, ag_w1]))

0 comments on commit d318e25

Please sign in to comment.