Skip to content

fix(core): agent registration if no endpoint is provided #478

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

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading