{"id":19880457,"url":"https://github.com/exsandebest/prlearn","last_synced_at":"2026-01-06T20:17:05.163Z","repository":{"id":240756018,"uuid":"800207080","full_name":"exsandebest/prlearn","owner":"exsandebest","description":"Parallel Reinforcement Learning Library","archived":false,"fork":false,"pushed_at":"2024-06-07T14:36:56.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T05:15:58.795Z","etag":null,"topics":["parallel-reinforcement-learning","python-library","reinforcement-learning","rl"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/prlearn","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exsandebest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-13T22:41:43.000Z","updated_at":"2024-06-29T09:41:01.000Z","dependencies_parsed_at":"2024-06-07T16:03:05.850Z","dependency_job_id":null,"html_url":"https://github.com/exsandebest/prlearn","commit_stats":null,"previous_names":["exsandebest/prlearn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exsandebest%2Fprlearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exsandebest%2Fprlearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exsandebest%2Fprlearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exsandebest%2Fprlearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exsandebest","download_url":"https://codeload.github.com/exsandebest/prlearn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245750818,"owners_count":20666246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parallel-reinforcement-learning","python-library","reinforcement-learning","rl"],"created_at":"2024-11-12T17:11:25.584Z","updated_at":"2026-01-06T20:17:05.144Z","avatar_url":"https://github.com/exsandebest.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PRLearn\n\nPRLearn is a Python library for **P**arallel **R**einforcement **Learn**ing. It leverages multiprocessing to accelerate experience collection and agent training, making RL experimentation faster and more efficient.\n\n## Key Features\n\n- **Flexible architecture**: Easily extendable with custom agents, environments, and combiners.\n- **Minimal dependencies**: Only Python 3.11+ and (optionally) multiprocess.\n- **Parallel data collection and training**: Reduce training time via multiprocessing.\n- **Agent combination**: Multiple strategies for aggregating agents (statistical, random, fixed, etc.).\n- **Flexible scheduling**: Control training stages via ProcessActionScheduler.\n\n\n## Installation\n\n```sh\npip install prlearn\n```\nOr with multiprocess support:\n```sh\npip install prlearn[multiprocess]\n```\n\n## Quick Start\n\n### Define Your Agent\n\n```python\nfrom prlearn import Agent, Experience\nfrom typing import Any, Dict, Tuple\n\nclass MyAgent(Agent):\n    def action(self, state: Tuple[Any, Dict[str, Any]]) -\u003e Any:\n        observation, info = state\n        # Action selection logic\n        pass\n    def train(self, experience: Experience):\n        obs, actions, rewards, terminated, truncated, info = experience.get()\n        # Training logic\n        pass\n```\n\n### Use Trainer for Parallel Training\n\n```python\nimport gymnasium as gym\nfrom prlearn import Trainer\nfrom prlearn.collection.agent_combiners import FixedStatAgentCombiner\n\nenv = gym.make(\"LunarLander-v2\")\nagent = MyAgent()\n\ntrainer = Trainer(\n    agent=agent,\n    env=env,\n    n_workers=4,\n    schedule=[\n        (\"finish\", 1000, \"episodes\"),\n        (\"train_agent\", 10, \"episodes\"),\n    ],\n    mode=\"parallel_learning\",  # optional\n    sync_mode=\"sync\",          # optional\n    combiner=FixedStatAgentCombiner(\"mean_reward\"),  # optional\n)\n\nagent, result = trainer.run()\n```\n\n### Custom Environment\n\n```python\nfrom prlearn import Environment\nfrom typing import Any, Dict, Tuple\n\nclass MyEnv(Environment):\n    def reset(self) -\u003e Tuple[Any, Dict[str, Any]]:\n        # Reset logic\n        return [[1, 2], [3, 4]], {\"info\": \"description\"}\n    def step(self, action: Any) -\u003e Tuple[Any, Any, bool, bool, Dict[str, Any]]:\n        # Step logic\n        return [[1, 2], [3, 4]], 1, False, False, {\"info\": \"description\"}\n```\n\n**See more usage examples in [docs/examples.md](https://github.com/exsandebest/prlearn/blob/master/docs/examples.md)**\n\n\n## Extending\n\n- **Custom agent**: Inherit from `Agent`, implement `action` and `train` methods.\n- **Custom environment**: Inherit from `Environment`, implement `reset` and `step` methods.\n- **Custom combiner**: Inherit from `AgentCombiner`, implement the `combine` method.\n\n\n## Testing\n\nTo run tests:\n```sh\npytest tests/\n```\n\n## License\n\nMIT License. See [LICENSE](https://github.com/exsandebest/prlearn/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexsandebest%2Fprlearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexsandebest%2Fprlearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexsandebest%2Fprlearn/lists"}