Agents

Author, run, and deploy rebase.Agent decision agents.

rebase.Agent is the model class for sequential decision policies: given an observed state, it decides an action. It exposes one cloud operation, act(...).

Not to be confused with the Autonomous Agents section: a rebase.Agent is a decision policy you deploy (e.g. a trading or control agent acting in an environment); autonomous agents are coding agents that search for models on your behalf.

Author

import rebase


class ThresholdTradingAgent(rebase.Agent):
    name = "threshold-trader"

    def act(self, price: float, position: float = 0.0, threshold: float = 50.0) -> dict:
        if price < threshold and position <= 0:
            return {"action": "buy", "volume": 1.0}
        if price > threshold and position > 0:
            return {"action": "sell", "volume": position}
        return {"action": "hold", "volume": 0.0}


model = ThresholdTradingAgent()

Run it in the cloud without deploying (target_type=model):

rebase run trading_agent.py --param price=42.5

Deploy and Invoke

Deploy (see Models for versioning, environments, and promotion):

rebase model deploy trading_agent.py --env dev

Call the deployed agent through its SDK act handle:

import rebase


agent = rebase.get_agent("default/threshold-trader")
decision = agent.act.remote(price=42.5, position=1.0)

Agent policies are developed and evaluated against Simulators locally; emflow's sequential-decision environments provide the backtesting loop before an agent is trusted with a deployed decision.

On this page