From 47406d1d826a458d9b6d840d555fa590a214aeb9 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 27 Nov 2023 15:17:27 +0200 Subject: [PATCH 1/5] fix: reset retries when giving up --- .../skills/decision_maker_abci/behaviours/tool_selection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py index 9e314e60e..65873393e 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py @@ -143,6 +143,7 @@ def _get_mech_tools(self) -> WaitableConditionType: if self.mech_tools_api.is_retries_exceeded(): error = "Retries were exceeded while trying to get the mech agent's data." self.context.logger.error(error) + self.mech_tools_api.reset_retries() return True if res is None: From 15e6e4dbc9c39a2ab10096d677739ba6f1dda164 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 27 Nov 2023 15:17:55 +0200 Subject: [PATCH 2/5] refactor: log the `url` instead of the API id --- .../skills/decision_maker_abci/behaviours/tool_selection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py index 65873393e..12d9b2dcf 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py @@ -147,7 +147,7 @@ def _get_mech_tools(self) -> WaitableConditionType: return True if res is None: - msg = f"Could not get the mech agent's tools from {self.mech_tools_api.api_id}" + msg = f"Could not get the mech agent's tools from {self.mech_tools_api.url}." self.context.logger.error(msg) self.mech_tools_api.increment_retries() return False From b0b19e3cefb4271958dd8563f6d9c2cdc0851de7 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 27 Nov 2023 15:18:35 +0200 Subject: [PATCH 3/5] fix: do not proceed if the mech tools were not set --- .../skills/decision_maker_abci/behaviours/tool_selection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py index 12d9b2dcf..4b74df888 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py @@ -253,6 +253,9 @@ def _try_recover_mech_tools(self) -> Optional[List[str]]: def _select_tool(self) -> Generator[None, None, Optional[int]]: """Select a Mech tool based on an e-greedy policy and return its index.""" yield from self._get_tools() + if self._mech_tools is None: + return None + self._set_policy() selected_idx = self.policy.select_tool() selected = self.mech_tools[selected_idx] if selected_idx is not None else "NaN" From d6271a0a23ecc702f2851bebc33cc766b3118746 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 27 Nov 2023 15:19:28 +0200 Subject: [PATCH 4/5] fix: do not store anything if no tool has been selected --- .../skills/decision_maker_abci/behaviours/tool_selection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py index 4b74df888..0c5910cd0 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py @@ -283,6 +283,8 @@ def async_act(self) -> Generator: mech_tools = json.dumps(self.mech_tools) policy = self.policy.serialize() utilized_tools = json.dumps(self.utilized_tools, sort_keys=True) + self._store_policy() + self._store_available_mech_tools() payload = ToolSelectionPayload( self.context.agent_address, @@ -292,6 +294,4 @@ def async_act(self) -> Generator: selected_tool, ) - self._store_policy() - self._store_available_mech_tools() yield from self.finish_behaviour(payload) From 72c8e52b21ccc33608b8b19af50412ded94c8f69 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 27 Nov 2023 15:21:16 +0200 Subject: [PATCH 5/5] chore: run generators --- packages/packages.json | 10 +++++----- packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- .../decision_maker_abci/behaviours/tool_selection.py | 3 ++- packages/valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index a01e409ff..2002eac78 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigdp4pgm4ons5pzptmclyglyxyqut266s4zutpmqj2e22wdpdkt5y", - "skill/valory/trader_abci/0.1.0": "bafybeiej7tgi23eihevyw6t4uvia63afwq7qyxosupvlpooi3hyeiot4vq", + "skill/valory/decision_maker_abci/0.1.0": "bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4", + "skill/valory/trader_abci/0.1.0": "bafybeihqqz7yvn33iirooeqk7e6iz4dr5grwrfbkavamis6bnfoz6yj5pu", "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeict4eqondm64jwst775rai7d2iw2m5x4rokjcoypmr3qv4vs6q5aa", - "service/valory/trader/0.1.0": "bafybeigwwsyu7keuvxz64ii3idce7ir4oqna7pnz4n6corrojd73kyatbq", + "agent/valory/trader/0.1.0": "bafybeigt6hd5cwuusdbu4u3ieqzvs4v4vihlr344rz55pb6neys55cwlre", + "service/valory/trader/0.1.0": "bafybeiaabwa7whlwpep5j2gpidnfvqgkgyo2vrw655t6epwtbh67umsb5m", "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeic6bveoijtjzvquphekmset7sondro4iknljf5qnylkadeeusiwp4", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 81d2f9795..8c818f56d 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic6bveoijtjzvquphekmset7sondro4iknljf5qnylkadeeusiwp4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeigdp4pgm4ons5pzptmclyglyxyqut266s4zutpmqj2e22wdpdkt5y -- valory/trader_abci:0.1.0:bafybeiej7tgi23eihevyw6t4uvia63afwq7qyxosupvlpooi3hyeiot4vq +- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4 +- valory/trader_abci:0.1.0:bafybeihqqz7yvn33iirooeqk7e6iz4dr5grwrfbkavamis6bnfoz6yj5pu - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 09babdcd9..42056048c 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeict4eqondm64jwst775rai7d2iw2m5x4rokjcoypmr3qv4vs6q5aa +agent: valory/trader:0.1.0:bafybeigt6hd5cwuusdbu4u3ieqzvs4v4vihlr344rz55pb6neys55cwlre number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py index 0c5910cd0..b382b3cb5 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/tool_selection.py @@ -147,7 +147,8 @@ def _get_mech_tools(self) -> WaitableConditionType: return True if res is None: - msg = f"Could not get the mech agent's tools from {self.mech_tools_api.url}." + url = self.mech_tools_api.url + msg = f"Could not get the mech agent's tools from {url}." self.context.logger.error(msg) self.mech_tools_api.increment_retries() return False diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index f898b9273..727fc65f9 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -21,7 +21,7 @@ fingerprint: behaviours/reedem.py: bafybeiekq77eatvf7xczbnyd4s6met4ci57ethwwoyxf5mhrcq7vuwiaxu behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm - behaviours/tool_selection.py: bafybeigfr2frkljrxyfxs5p3j42equzehgaqtkyuxk6eiujyudr6ajqakm + behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index db407833f..0dbd0b22a 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeigdp4pgm4ons5pzptmclyglyxyqut266s4zutpmqj2e22wdpdkt5y -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic6bveoijtjzvquphekmset7sondro4iknljf5qnylkadeeusiwp4 +- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index a544b6d2c..a47fac04a 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeigdp4pgm4ons5pzptmclyglyxyqut266s4zutpmqj2e22wdpdkt5y +- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4 - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: