Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): integrate domain + full agent address in Envelope and handler #573

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update: example
Archento committed Oct 29, 2024
commit 856731d15b6887e9e94ea26c0656b36b2d3f9281
4 changes: 2 additions & 2 deletions python/examples/13-agent-name-service/agent1.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@


class Message(Model):
message: str
text: str


DOMAIN = "bob.example.agent"
@@ -39,7 +39,7 @@ async def register_agent_name(ctx: Context):

@bob.on_message(model=Message)
async def message_handler(ctx: Context, sender: str, msg: Message):
ctx.logger.info(f"Received message from {sender}: {msg.message}")
ctx.logger.info(f"Received message from {sender}: {msg.text}")


if __name__ == "__main__":
10 changes: 5 additions & 5 deletions python/examples/13-agent-name-service/agent2.py
Original file line number Diff line number Diff line change
@@ -2,24 +2,24 @@


class Message(Model):
message: str
text: str


alice = Agent(
name="alice-0",
name="alice",
seed="agent alice-0 secret phrase",
port=8000,
endpoint=["http://localhost:8000/submit"],
)

DOMAIN = "example.agent"
DOMAIN = "bob.example.agent"


@alice.on_interval(period=5)
async def alice_interval_handler(ctx: Context):
bob_name = "bob-0" + "." + DOMAIN
bob_name = DOMAIN
ctx.logger.info(f"Sending message to {bob_name}...")
await ctx.send(bob_name, Message(message="Hello there bob."))
await ctx.send(bob_name, Message(text="Hello there bob."))


if __name__ == "__main__":