Code Monkey home page Code Monkey logo

agent-academy-2's Introduction

agent-academy-2

Valory's Agent Academy 2 - participant repo

  • Clone the repository:

    git clone [email protected]:valory-xyz/agent-academy-2.git
    
  • System requirements:

  • Pull pre-built images:

    docker pull trufflesuite/ganache:beta
    
  • Create development environment:

    make new_env && pipenv shell
    
  • Configure command line:

    autonomy init --reset --author academy2 --remote --ipfs --ipfs-node "/dns/registry.autonolas.tech/tcp/443/https"
    
  • Pull packages:

    autonomy packages sync --update-packages
    
  • During development use make formatters, make code-checks and make generators

Running the Keep3r

To run the end-to-end tests with four agents against V2 fork of Goerli

pytest packages/keep3r_co/agents/keep3r_bot/tests/test_agents/test_keep3r_bot_abci.py::TestKeep3rABCIFourAgentsV2

Custom jobs

The jobs directory contains jobs developed by us. It currently contains veOLAS job. This job is supported by our keep3r service, among other jobs from third parties.

agent-academy-2's People

Contributors

karrenbelt avatar davidminarsch avatar 0xardi avatar adamantios avatar dvilelaf avatar gabrielfu avatar philippb90 avatar angrybayblade avatar deadzen avatar 8ball030 avatar jaysonph avatar jmoreira-valory avatar

Stargazers

 avatar Michael Gruen avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

agent-academy-2's Issues

Performative check

Ledger and contract api calls can result in an incorrect (e.g. error) performative. We should return specific failure response, and deal with this event separately. We might also raise a custom IncorrectPerformativeError which can be intercepted at the level of the round, where all errors may transition to PathSelectionRound.

Failed to `make hashes` on Windows

On Windows Powershell, after installing make on chocolatey, I failed to make hashes for the package.

I successfully fingerprinted the component, but running make hashes does not change the hashes.csv file.

@8ball030

PS D:\GitHub\agent-academy-2> pipenv shell
Loading .env environment variables...
Launching subshell in virtual environment...
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\GitHub\agent-academy-2> cd .\packages\gabrielfu\
PS D:\GitHub\agent-academy-2\packages\gabrielfu> aea fingerprint contract gabrielfu/keep3r_job:0.1.0
Fingerprinting contract components of 'gabrielfu/keep3r_job:0.1.0' ...
PS D:\GitHub\agent-academy-2\packages\gabrielfu> cd ..\..
PS D:\GitHub\agent-academy-2> make hashes
'grep' is not recognized as an internal or external command,
operable program or batch file.
python scripts/generate_ipfs_hashes.py
'grep' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, rm -fr build/, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [Makefile:12: clean-build] Error 2
Waiting for 15.0 seconds the IPFS daemon to be up.
Processing package keep3r_job of type contract
Traceback (most recent call last):
  File "scripts/generate_ipfs_hashes.py", line 427, in update_hashes
    update_fingerprint(configuration_obj, client)
  File "scripts/generate_ipfs_hashes.py", line 331, in update_fingerprint
    fingerprint = compute_fingerprint(
  File "scripts/generate_ipfs_hashes.py", line 312, in compute_fingerprint
    assert_hash_consistency(fingerprint, package_path, client)
  File "scripts/generate_ipfs_hashes.py", line 264, in assert_hash_consistency
    assert (
AssertionError: WARNING, hashes don't match for: packages\gabrielfu\contracts\keep3r_job\contract.py
make: *** [Makefile:55: hashes] Error 1

CheckSafeExistenceRound

this round should not exist as part of the Keep3rJobAbciApp as the logic involved should reside elsewhere. One can look at the OracleABCIApp to see how this has been dealt with there.

see also: #56 (comment)

`GetJobsPayload` & `JobSelectionBehaviour`

The content of this payload is job_list: List[str] and it's property casts to string job_list(self) -> str. This was for done out of convenience since lists are not serializable at the moment. However, the __init__ and property return should be of the same type

class GetJobsPayload(BaseKeep3rJobPayload):
"""GetJobsPayload"""
_data_keys: Tuple[str] = ("job_list",)
transaction_type = TransactionType.JOB_LIST
def __init__(self, sender: str, job_list: List[str], **kwargs: Any) -> None:
"""Initialize an 'get_jobs' transaction payload.
:param sender: the sender (Ethereum) address
:param job_list: The job list
:param kwargs: the keyword arguments
"""
super().__init__(sender, **kwargs)
self._job_list = job_list
@property
def job_list(self) -> str:
"""Get the job list."""
return "".join(self._job_list)

This can easily lead to issues, such as here:

  1. selection behaviour treating it as List[str] still

    class JobSelectionBehaviour(Keep3rJobBaseBehaviour):
    """JobSelectionBehaviour"""
    behaviour_id: str = "job_selection"
    matching_round: Type[AbstractRound] = JobSelectionRound
    def async_act(self) -> Generator:
    """
    Behaviour to get whether job is selected.
    job selection payload is shared between participants.
    """
    with self.context.benchmark_tool.measure(self.behaviour_id).local():
    if not self.synchronized_data.job_list:
    current_job = None
    else:
    addresses = self.synchronized_data.job_list
    period_count = self.synchronized_data.period_count
    job_ix = period_count % len(addresses)
    current_job = addresses[job_ix]
    payload = JobSelectionPayload(self.context.agent_address, current_job)
    self.context.logger.info(f"Job contract selected: {current_job}")
    with self.context.benchmark_tool.measure(self.behaviour_id).consensus():
    yield from self.send_a2a_transaction(payload)
    yield from self.wait_until_round_end()
    self.set_done()

  2. IsWorkableRound updating the shared state changes what was originally a List[str] into a str when not workable

    # remove the non-workable job, then transition to JobSelectionRound
    current_job = cast(str, self.synchronized_data.current_job)
    job_list = self.synchronized_data.job_list.replace(current_job, "")
    state = self.synchronized_data.update(job_list=job_list)
    return state, Event.NOT_WORKABLE

Note that - in case of WORKABLE and NOT_PROFITABLE the job should also be removed from the list. It is probably smarter to:

  • set current_job to an empty string or None in GetJobsRound (and set job_list as we do now)
  • remove a job from the list when selecting it first during JobSelection, which should lead to a situation where the current_job is never among the job_list

P.S.
leaving a reference to this comment to be addressed as well: #106 (comment)

Remove `WaitingRound`, `AwaitTopUpRound`

WaitingRound

the waiting round logic, required because of the bond_time, can be subsumed by the path selection round, where this currently already being checked, or preferably; moved to the activation round entirely (and this logic removed from path selection).

AwaitTopUpRound

We may also remove the AwaitTopUpRound and in case of insufficient funds redirect to PathSelection (self) instead, or a degenerate state, which we can direct it to PathSelection in the during ABCIApp chaining; then someone else might direct this elsewhere in another setup (e.g. refueling).

Add windows CI

We need ci for these tests in windows, Too many issues reported to me from windows users

DegenerateRound in ABCIApp

@Adamantios suggests that the DegenerateRound that we transition to on UNKNOWN_HEALTH_ISSUE should be renamed.

As this UNKNOWN_HEALTH_ISSUE is not of immediate concern, I've opened this ticket on it.

Error handling

The idea would be to catch errors, such as those from failed contracts calls (e.g. incorrect performative or other), and keep a record of them throughout the period. When too many occur, we transition from the PathSelectionRound via UNKNOWN_HEALTH_ISSUE into a degenerate state.

Refactor tests

Port tests into packages, remove tests folder and remove third party submodules

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.