fetch-logo
ConceptsConceptsGuidesGuidesExamplesExamplesReferencesReferencesAPIsAPIs
GitHub (opens in a new tab)
  • References
        • Almanac contract overview
        • Registration and endpoints weighting
    • Ledger
      • Versions
      • Active networks
      • Mainnet archives
      • Validators security
    • Indexer
      • Endpoints / Playground UIs
      • Querying
      • Entities
      • Versioning
  • References
        • Almanac contract overview
        • Registration and endpoints weighting
          • Endpoint weighting
    • Ledger
      • Versions
      • Active networks
      • Mainnet archives
      • Validators security
    • Indexer
      • Endpoints / Playground UIs
      • Querying
      • Entities
      • Versioning
References
Contracts
Almanac contract and remote communication
Registration and endpoints weighting

Registration and endpoints weighting

Agents can communicate in a remote fashion with one another across different locations on the internet. This is achievable by using the Agent address to register into the Almanac contract ↗️ (by first paying a small fee), and then querying the Almanac to retrieve an HTTP endpoint of a recipient agent.

Whenever agents registers in the Almanac, they must specify the service endpoints it provides alongside a weight parameter for each endpoint provided. Then, when any agent tries to communicate with this agent, the service endpoint will be chosen using a weighted random selection.

For additional information on Agents addresses, have a look at our addresses guide ↗️.

Endpoint weighting

There exist two format options when defining your agent's endpoints:

  • List format: This defines the agent's endpoints as a list of strings. The weights will be automatically assigned a value of 1.

    agent = Agent(
        name="alice",
        port=8000,
        seed="agent secret phrase",
        endpoint=["http://127.0.0.1:8000/submit","http://127.0.0.1:8001/submit"]
    )
  • Dictionary format: This defines the agent's endpoints in a Dict format, specifying the weight for each endpoint. If the weight parameter is not specified, it will be assigned a value of 1.

    agent = Agent(
        name="alice",
        port=8000,
        seed="agent recovery seed phrase",
        endpoint={
            "http://127.0.0.1:8000/submit": {"weight": 2},
            "http://127.0.0.1:8001/submit": {}, # weight value = 1
        },
    )

You can now head towards the following dedicated guides showing you how to:

  • Register in the Almanac contract ↗️.
  • Communicating with other agents 📱🤖 ↗️.

Was this page helpful?

Almanac contract overviewLedger
footer-logo

Main website

Integrations

Events

We’re hiring!

Twitter (opens in a new tab)Telegram (opens in a new tab)Discord (opens in a new tab)GitHub (opens in a new tab)Youtube (opens in a new tab)LinkedIn (opens in a new tab)Reddit (opens in a new tab)
Sign up for developer updates