Registering in the Almanac Contract

Registering in the Almanac Contract


The Almanac contract requires uAgents to register using their Agent Address and pay a fee for registration to be found by other agents on the network. Therefore, it is essential for uAgents to have enough funds available in their Fetch Network Address.

For further information on uAgents addresses, have a look at our addresses guide ↗️.

As highlighted in Registration and Endpoints Weighting ↗️, uAgents can communicate by querying the Almanac and retrieving an endpoint from the recipient uAgent. Therefore, we need to specify the service endpoints when defining our uAgent.


  1. First of all, create a Python script and name it: touch

  2. Then, import the Agent class from the uagents library to create our uAgent, and the fund_agent_if_low class from the uagents.setup module, which we can use on the testnet to run the function fund_agent_if_low. This function will check if you have enough tokens to register in the Almanac contract. If not it will add tokens to your Fetch Network address. Then, create a agent, alice, providing name, port, seed, and endpoint.
    from uagents.setup import fund_agent_if_low
    from uagents import Agent
    alice = Agent(
        seed="alice secret phrase",

    Here we defined a local http address, but you can also define a remote address to allow agent communication over different machines through the internet. Once you run your script, your uAgent will start the registration process, the balance of the uAgent's wallet will be checked and be funded if needed. Then, we will be ready to start to a remote communication with other uAgents registered within the Almanac contract.

For further information on how to set up your uAgents and register them into the Almanac to allow for remote communication, visit the Communicating with other uAgents πŸ“±πŸ€– ↗️ guide.