diff --git a/prediction_market_agent_tooling/deploy/agent.py b/prediction_market_agent_tooling/deploy/agent.py index c774734a..e3b31d33 100644 --- a/prediction_market_agent_tooling/deploy/agent.py +++ b/prediction_market_agent_tooling/deploy/agent.py @@ -25,9 +25,9 @@ class MonitorConfig(BaseModel): LABEL_PREFIX: t.ClassVar[str] = "monitor_config_" start_time: datetime - end_time: t.Optional[ - datetime - ] = None # TODO: If we want end time, we need to store agents somewhere, not just query them from functions. + end_time: t.Optional[datetime] = ( + None # TODO: If we want end time, we need to store agents somewhere, not just query them from functions. + ) manifold_user_id: str | None = None omen_public_key: str | None = None @@ -110,16 +110,19 @@ def {entrypoint_function_name}(request) -> str: gcp_fname = gcp_fname or self.get_gcloud_fname(market_type) + # For labels, only hyphens (-), underscores (_), lowercase characters, and numbers are allowed in values. labels = (labels or {}) | { + "market_type": market_type.value, + } + env_vars = (env_vars or {}) | { "repository": repository, "commit": git.Repo(search_parent_directories=True).head.object.hexsha, - "market_type": market_type.value, "agent_class": self.__class__.__name__, } if monitor_config is not None: monitor_config.validate_monitor_config(market_type) - env_vars = (env_vars or {}) | { + env_vars |= { f"{MonitorConfig.LABEL_PREFIX}{k}": v for k, v in monitor_config.model_dump().items() if v is not None diff --git a/prediction_market_agent_tooling/monitor/monitor.py b/prediction_market_agent_tooling/monitor/monitor.py index 9f59d9a4..f5b93113 100644 --- a/prediction_market_agent_tooling/monitor/monitor.py +++ b/prediction_market_agent_tooling/monitor/monitor.py @@ -51,7 +51,7 @@ def get_all_deployed_agents_gcp() -> t.Sequence["DeployedAgent"]: agents.append( DeployedAgent( name=function.name, - agent_class=function.labels["agent_class"], + agent_class=function.environment_variables["agent_class"], market_type=MarketType(function.labels["market_type"]), monitor_config=MonitorConfig.model_validate( {