Live monitoring

For an agent in monitoring you generally do not have to provide private keys. This is possbile because in monotoring, the agents makes no transcations, it just observes.

We therefore recommend that you keep your private keys private and instead inherit from the ImpersonationAgent.

run.py
class TrackHealthFactorAgent(MonitoringAgent):
  """An agent that displays health factor as its reward."""
 
  def __init__(
      self,
      impersonation_address: str,
      name: Optional[str] = None,
  ):
      """Initialize the agent."""
      super().__init__(
          name=name,
          impersonation_address=impersonation_address,
          unit_token="USDC",
          policy=AAVEv3Policy(),
      )
run.py
agent1 = TrackHealthFactorAgent(
  impersonation_address="0x9c1d67674dE93b71ea16893C95dDA6f4D266a2bC",
  name="Alice",
)

Dojo can only backtest environments with backend_type='live'.

Calling monitor_run will.

  • Connect to the RCP node
  • Create a local database file that all data is written to
  • If so requested, it launches a server that serves the data file over http. Our App can connect to this.
  • As new blocks come in, it asks all agents to make decisions on what actions they would execute.
    • At this point the agent can also compute arbitary signals for later analysis.
  • Agent actions are not actually executed in during monitoring.
  • Tracked metrics of all agents and protocol and writes them to the database file for analysis