Interval task with Agents
Introduction
This file can be run on any platform supporting Python, with the necessary install permissions.
This example shows how to use the uAgents Framework library to set up an interval task using the on_interval()
decorator.
Please check out the example code in our examples repo (opens in a new tab) to run this locally.
Guide
Supporting documentation
The agent
Self hosted
interval-task.pyfrom uagents import Agent, Context alice = Agent(name="alice", seed="alice recovery phrase") @alice.on_interval(period=2.0) async def say_hello(ctx: Context): ctx.logger.info(f'hello, my name is {alice.name}') if __name__ == "__main__": alice.run()