Skip to content

Commit

Permalink
add injector util
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason committed Apr 24, 2024
1 parent 80810e4 commit 0608df9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions utils/inject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
import json
import argparse
import redis

parser = argparse.ArgumentParser(description='inject thoughts into simulation')
parser.add_argument('--id', required=True, help='id of simulation')
parser.add_argument('--name', required=True, help='name of the agent')
parser.add_argument('--msg', required=True, help='thought for the agent')
args = parser.parse_args()

redis_url = os.getenv("REDIS_URL")
redis_client = redis.StrictRedis.from_url(redis_url, decode_responses=True)
package = {"name": args.name, "msg": args.msg}
redis_client.rpush(f"{args.id}:communications",json.dumps(package))

0 comments on commit 0608df9

Please sign in to comment.