Skip to main content

What is Humanoid Agents?

| Demo | YouTube Walkthrough (2m)

Humanoid agents is a platform for building agents inspired by how humans think, talk and behave. Humanoid Agents does by complementing System 2 logical thinking with System 1 thinking based on embodied conditions such as the fulfilment of their basic needs, emotions and their relationships with others.

We are happy to announce that Humanoid Agents has been accepted to EMNLP System Demonstrations 2023!

image info

Contents

Installation

From pip

pip install humanoidagents

From source

if you're planning to make code changes

git clone https://github.com/HumanoidAgents/HumanoidAgents.git
cd HumanoidAgents
pip install -e .

Get Started

Run a simulation like this:

python run_simulation.py --output_folder_name ../generations/big_bang_theory \
--map_filename ../locations/big_bang_map.yaml \
--agent_filenames ../specific_agents/sheldon_cooper.json ../specific_agents/leonard_hofstadter.json ../specific_agents/penny.json

Window users: avoid using "\" in command

Prerequisites

  1. export OPENAI_API_KEY=sk-... to use your OpenAI Key. Please be careful not to exceed your quota since every simulated day with 2 to 3 agents cost around $5-10 and takes 45-60 minutes given the number of API calls. For Window users, this should be set OPENAI_API_KEY=sk-...

Required arguments

  1. --output_folder_name refers to the folder where the generated output will be stored
  2. --map_filename refers to the filename of the map used (see section below for list of built in maps)
  3. --agent_filenames refers to the list of agent specifications (see section below for list of built in agents)

Optional arguments

  1. --default_agent_config_filename refers to the default agent config file where we define the types of basic needs that every agent has. For more details, refer to the section below.

  2. --start_date refers to the (inclusive) start date of the interested date range. The format is YYYY-MM-DD e.g. 2023-01-03. Kindly note that the date should not be earlier than 2023-01-03 since we use 2023-01-02 as the global_start_date for user-defined memories. If that is required, please adjust the global start date in code.

  3. --end_date refers to the (inclusive) end date of the interested date range. The format is YYYY-MM-DD e.g. 2023-01-04

  4. --condition as noted in the paper, we can adjust the starting condition of all agents (in terms of their basic needs, emotion and closeness to others). You can use this to specify a condition (e.g. health) for all agents to be 0. See the list of accepted arguments on argparse

Customizing locations and specific agents

Currently, we support three built-in settings

  1. Big Bang Theory --map_filename ../locations/big_bang_map.yaml \ --agent_filenames ../specific_agents/sheldon_cooper.json ../specific_agents/leonard_hofstadter.json ../specific_agents/penny.json

  2. Friends --map_filename ../locations/friends_map.yaml \ --agent_filenames ../specific_agents/joey_tribbiani.json ../specific_agents/monica_gellor.json ../specific_agents/rachel_greene.json

  3. Lin Family --map_filename ../locations/lin_family_map.yaml \ --agent_filenames ../specific_agents/eddy_lin.json ../specific_agents/john_lin.json

To create your own setting, you can create your own map as well as your own specific agents. The fields you need to fill for each can be learned from looking at the examples.

One thing to know is that agents and map are not completely decoupled. For every agent_filename you specify, the name field of the agent has to be contained in the map.yaml under Agents as a key. This sets the initial location of the agent on the map.

Analytics Dashboard

image info

The generated data can be visualized by a interactive dashboard. You can select the agent in the world to visualize their status.

It consists of the graph of basic needs and the graph of social relationship with the corresponding information including the emotion, conversation details.

To run the dashboard, run the following

python run_dashboard.py --folder <folder/containing/generation/output/from/run_simulation.py> 

Required arguments

  1. --folder refers to the folder where the generated output have be stored from run_simulation.py
  2. --mode refers to the method of selecting data from the folder. It has two modes: 1) all: visualizing all files in the folder 2) date_range: visualizing files with interested date range (need to state the date range in arguments)

Optional arguments

  1. --start_date refers to the (inclusive) start date of the interested date range when --mode = date_range. The format is YYYY-MM-DD e.g. 2023-01-03
  2. --end_date refers to the (inclusive) end date of the interested date range when --mode = date_range. The format is YYYY-MM-DD e.g. 2023-01-04

Unity WebGL Game interface

The Game Interface using Unity WebGL is available on humanoidagents.com

Support for customized locations and agents is coming soon!

See a 2 minute YouTube Walkthrough below.

Video

How does Humanoid Agents work?

image info

Step 1. Agent is initialized based on user-provided seed information. Step 2. Agent plans their day.
Step 3. Agent takes an action based on their plan. Step 4. Agent evaluates if action taken changes their basic needs status and emotion. Step 5. Agent can update their future plan based on the satisfaction of their basic needs and emotion. Step 3a. Agent can converse with another agent if in the same location, which can affect the closeness of their relationship.

(Optional) Adding new basic needs

You might also be interested to add/remove further basic needs to agents other than the five we have as a default (fullness, social, health, fun and energy)

To do that, you can create your own default_agent_config.json file.

Each basic need requires the following format in order for the code to support them.

{
    "name": "fullness", 
    "start_value": 5, 
    "unsatisfied_adjective": "hungry", 
    "action": "eating food", 
    "decline_likelihood_per_time_step": 0.05, 
    "help": "from 0 to 10, 0 is most hungry; increases or decreases by 1 at each time step based on activity"
}

(Optional/Advanced) Extending HumanoidAgent class

If you're reading this, you have played around with the code and now you're ready to take it to the next level.

Instead of using our code, you want to extend it to support more aspects for an Agent such as personality, empathy, moral values or whatever aspect you're interested in.

We provide an abstract interface at customized_humanoid_agent.py to demonstrate the main functions you have to override to modify the behavior of the agent.

You don't have to modify every method (if you don't and don't want the NotImplementedError to be raised, please remove the function altogether). Instead, simply modify whichever method you need and the others will inherit from HumanoidAgent.

Future Plans

  • Support customized map and agents on Game Interface
  • Support other LLMs
  • Support other aspects of System 1 thinking

Metadata

Release files for humanoidagents 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for humanoidagents 0.1.2
File Interpreter ABI Platform
humanoidagents-0.1.2-py3-none-any.whl Python 3 none any Details

Release files / humanoidagents-0.1.2-py3-none-any.whl

Download URL humanoidagents-0.1.2-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2e1211d090dfeef423d5dc1ad20c98bec89089b2fc684e73318a45cb65d31e4
BLAKE2b-256 checksum
How to use checksums
59dcf8846882209f8cdda0ac9cc12cf5784aab5d4a6e04fe9a090e3d4e4750bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for humanoidagents 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page