cosmicBboy / langgym

Train agents using natural language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿฆœ๐Ÿฆพ LangGym

A framework for building Natural Language RL Agents.

NOTE โ„น๏ธ
This project is currently a proof of concept for a broader framework for using language models as the agent's behavior policy instead of traditional reinforcement learning techniques to power agents.

โš™๏ธ Setup

Create a virtual environment

python -m venv ~/venvs/langgym
source ~/venvs/langgym/bin/activate
pip install -e .

Export your OpenAI API key:

export OPENAI_API_KEY=...

๐Ÿ‘Ÿ Run a Simulation

Run a simulation with

python langgym/simple.py --max-cycles 20 --goal-reward -0.05 --output-dir experiments

๐ŸŽฎ Game Dashboard

Visualize simulations with the streamlit dashboard:

streamlit run langgym/dashboard.py

๐Ÿ’ก Ideas for Improvement

These are a few ideas to improve the NLRLA (natural-language generative agent):

  • ๐Ÿง  Memory: Add a text representation of the agent's experiences so far into its internal memory.
  • ๐Ÿ“ Summarized Memories: Store an external memory buffer of observations, actions, and rewards, and ask the agent to summarize its experience so far. Add this to the agent's internal memory.
  • ๐Ÿ’ญ Strategic Reflection: Ask the agent to create high-level strategies, which are feed into its own prompt when generating an action.

๐Ÿ›ฃ Roadmap

These are items in the roadmap, in no particular order:

  • ๐Ÿ‘‰ Support multi-agent Environments in the Multi Particle Environment suite from the PettingZoo library (see here)
  • ๐Ÿ‘‰ Support additional environment suites, like Atari, Classic, etc.
  • ๐Ÿ‘‰ Create LangGym API for traversing a Universe of different Environments. Agents can choose which environments they want to play in.
  • ๐Ÿ‘‰ Create persistent agents that can store internal memories across their experiences across the different Environments.
  • ๐Ÿ‘‰ Support use of lighter-weight language models like Alpaca, Pythia, etc.

About

Train agents using natural language

License:MIT License


Languages

Language:Python 100.0%