Local Agent Inspector
The Local Agent Inspector is a developer tool on Agentverse that enhances the debugging and monitoring experience for Agents running on a local infrastructure . It allows you to track and understand the real-time behavior of these Agents, whether they are connected to Agentverse or not. The tool offers developers detailed insights into your local agent’s performance and interactions, even though the agent itself is run within your infrastructure.
Local Agents can communicate and interact with other Agents and Functions connected to the Agentverse and Fetch Network through a Mailbox. For more information on Mailbox and how to connect local Agents and their function to the Agentverse, have a look at these guides:
The Inspector tool provides developers with multiple key insights, including the agent’s address, details about its local and external endpoints, the types of messages sent and received, and comprehensive data about the sender and recipient of each message. This functionality makes it easier to monitor communication flows, troubleshoot issues, and analyze performance in real-time.
By visualizing this information, the Local Agent Inspector allows you to maintain real-time oversight of how your Agent interacts with other Agents and systems, facilitating easier troubleshooting, performance analysis, and optimizing communication flows. This functionality is particularly valuable for complex applications where local Agents are responsible for processing real-time tasks, interacting with other Agents, or managing resources directly. It provides a way to see how your Agent is performing within a networked environment, while still retaining the benefits of local execution and control.
All messages data regarding a particular local agent are then presented as a list through which it is also possible to access the payload for the message being examined.
If you're managing multiple local agents, the Inspector will show a complete list of all running agents. While support for agents managed through a Bureau
is not available in the initial version, it will be added soon. This way, you will have a complete view of your Agents running locally alongside with the relevant details.
In the near future, developers will also have the option to connect their local Agents directly to Agentverse through the Inspector, making it even easier to manage and monitor each Agent interactions.
How to access the Local Agent Inspector
You can access the Local Agent Inspector by first coding and defining your Agent.
For instance, consider the following simple local agent:
agent_inspector_example.pyfrom uagents import Agent, Context, Model class Message(Model): message: str bob = Agent( name="Bob", port=8001, seed="BobSecretPhrase", endpoint=["http://127.0.0.1:8001/submit"], ) print(f"Your agent's address is: {bob.address}") @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}') await ctx.send(sender, Message(message="Hello There!")) if __name__ == "__main__": bob.run()
Once you successfully run your local agent and register it into the Almanac (Make sure your Agent has enough funds to do so!), you will be able to access the Inspector via the terminal log, which provides a dedicated link to the Inspector page.
By running the above Agent, the output you get should be similar to the following:
Your agent's address is: agent1qvrapvpxltu54tt3qnud5mlkul9y9d9tfn7xfpq4ec74cq4mkym6yl3jkdw INFO: [ Bob]: Registration on Almanac API successful INFO: [ Bob]: Registering on almanac contract... INFO: [ Bob]: Registering on almanac contract...complete INFO: [ Bob]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8001&address=agent1q2kxet3vh0scsf0sm7y2erzz33cve6tv5uk63x64upw5g68kr0chkv7hw50 INFO: [ Bob]: Starting server on http://0.0.0.0:8001 (Press CTRL+C to quit)
By clicking on the dedicated link depicted here, you will then be redirected to the Inspector Dashboard. A pop-up message will appear saying that your Agent was connected successfully.
Here you can view all the information about your local Agent, including details about all messaged sent and received by the Agent.