fetchai / uAgents

A fast and lightweight framework for creating decentralized agents with ease.
Apache License 2.0
995 stars 241 forks source link

Agent not found from API #452

Closed ManueleSigona closed 4 months ago

ManueleSigona commented 4 months ago

Prerequisites

Category

Bug (unexpected behavior)

Expected Behavior

After running a local agent where agentverse="https://agentverse.ai", querying https://agentverse.ai/v1/almanac/agents/{my-agent-address} should find my agent.

Observed Behavior

Querying https://agentverse.ai/v1/almanac/agents/{my-agent-address} returns: {"detail":"agent not found"} See reproducer below.

To Reproduce

from uagents import Agent, Context

bob = Agent(
    name="bob",
    seed="bob secret phrase 123",
    port=8005,
    endpoint="http://localhost:8005/submit",
    agentverse="https://agentverse.ai",
)

@bob.on_event("startup")
async def startup(ctx: Context):
    ctx.logger.info(f"uAgent name: {ctx.agent.name}")
    ctx.logger.info(f"uAgent address: {ctx.agent.address}")

if __name__ == "__main__":
    bob.run()

I run this script, it prints the following:

INFO:     [  bob]: Almanac registration is up to date!
INFO:     [  bob]: uAgent name: bob
INFO:     [  bob]: uAgent address: agent1qfdczw93363zmzp7cxxg5fr0j9sg8tmtrxnu67sfp3fz2dyzyv345ph3x2e
INFO:     [  bob]: Starting server on http://0.0.0.0:8005 (Press CTRL+C to quit)

Then I go to https://agentverse.ai/v1/almanac/agents/agent1qfdczw93363zmzp7cxxg5fr0j9sg8tmtrxnu67sfp3fz2dyzyv345ph3x2e but it doesn't find my agent. I also tried to wait for ~10 minutes, in case there are some delays, but it still returned the same message.

Version

main (627a8a5785ff4b4f545f9cae07fd40c1886a915d)

Environment Details (Optional)

No response

Failure Logs (Optional)

No response

Additional Information (Optional)

No response

Archento commented 4 months ago

The documentation is currently not up to date but what you are looking for is this.

See also example 11: link

Running an agent locally and using the agentverse property enables the mailbox service to be used as a proxy. This is useful when your agent is in an unstable network environment or when you don't want it to be online 24/7. Agent to agent communication is done by using the agent address as a destination and that will be resolved internally and independently of its real endpoint.

The url that you are trying to connect to is only valid when hosting your agent in the Agentverse.

Archento commented 4 months ago

I hope that the problem is resolved now so I'll close this issue. If you encounter the same or other errors feel free to open another Ticket here or in the Agentverse repo when it concerns something like the Agentverse API.