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.
while agents running in a bureau are not supported in the initial version, we will be adding support for this very soon
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, yo 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 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 from uagents.setup import fund_agent_if_low class Message(Model): message: str bob = Agent( name="Bob", port=8001, seed="BobSecretPhrase", endpoint=["http://127.0.0.1/:8001/submit"], ) fund_agent_if_low(bob.wallet.address()) 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, 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 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://127.0.0.1:8001 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.
As you can see, here your local Agent will be listed and a pop-up message will appear saying that your Agent was added to the list. By clicking the dedicated Connect Agent button, you are able to connect Agents to the inspector by providing the Agent Address.
Instead, by clicking on the Agent box, you can enter the Inspector Dashboard and check out all details about your Local Agent and its messages: