Skip to content

Commit

Permalink
fix(core): agent registration if no endpoint is provided (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archento authored Jul 31, 2024
1 parent 7352046 commit b83a0a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions python/examples/07-msg-verification/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ async def bob_rx_message(ctx: Context, sender: str, msg: Message):

ctx.logger.info(f"Received message from {sender}: {msg.message}")

msg = "Hello there alice."
digest = encode(msg)
outbound_msg = "Hello there alice."
digest = encode(outbound_msg)

# send the response
await ctx.send(
alice.address,
Message(message=msg, digest=digest.hex(), signature=bob.sign_digest(digest)),
Message(
message=outbound_msg, digest=digest.hex(), signature=bob.sign_digest(digest)
),
)


Expand Down
6 changes: 5 additions & 1 deletion python/src/uagents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,12 @@ async def _startup(self):
Perform startup actions.
"""
if self._endpoints is not None:
if self._endpoints:
await self._registration_loop()
else:
self._logger.warning(
"No endpoints provided. Skipping registration: Agent won't be reachable."
)
for handler in self._on_startup:
try:
await handler(self._ctx)
Expand Down

0 comments on commit b83a0a2

Please sign in to comment.