Skip to content

Commit 0804c99

Browse files
authored
Merge pull request game-by-virtuals#67 from stevensf1998/feat/update-readme
update read me
2 parents b6a33f4 + bc7260b commit 0804c99

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/game_sdk/hosted_game/README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ The SDK provides another interface to configure agents that is more friendly to
3030
```python
3131
from game_sdk.hosted_game.agent import Agent
3232

33+
34+
3335
# Create agent with just strings for each component
36+
> [!NOTE]
37+
> {{replyCount}} is a variable that will be replaced with the number of replies made by the agent. Only applicable for task_description.
38+
3439
agent = Agent(
3540
api_key=VIRTUALS_API_KEY,
3641
goal="Autonomously analyze crypto markets and provide trading insights",
3742
description="HODL-9000: A meme-loving trading bot powered by hopium and ramen",
38-
world_info="Virtual crypto trading environment where 1 DOGE = 1 DOGE"
43+
world_info="Virtual crypto trading environment where 1 DOGE = 1 DOGE",
44+
task_description="Process incoming tweet. Ignore if it is boring or unimportant. Total replies made: {{replyCount}}. Ignore if the conversation has gone too long."
3945
)
4046
```
4147

@@ -44,25 +50,43 @@ You can also initialize the agent first with just the API key and set the goals,
4450
```python
4551
agent = Agent(api_key=VIRTUALS_API_KEY)
4652

47-
# check what is current goal, descriptions and world_info
53+
# check what is current goal, descriptions, world_info and task_description
4854
agent.get_goal()
4955
agent.get_description()
5056
agent.get_world_info()
57+
agent.get_task_description()
5158

52-
# Set components individually - set change the agent goal/description/worldinfo
59+
# Set components individually - set change the agent goal/description/worldinfo/task_description
5360
agent.set_goal("Autonomously analyze crypto markets and provide trading insights")
5461
agent.set_description("HODL-9000: A meme-loving trading bot powered by hopium and ramen")
5562
agent.set_world_info("Virtual crypto trading environment where 1 DOGE = 1 DOGE")
63+
agent.set_task_description("Process incoming tweet. Ignore if it is boring or unimportant. Total replies made: {{replyCount}}. Ignore if the conversation has gone too long.")
5664

57-
# check what is current goal, descriptions and world_info
65+
# check what is current goal, descriptions, world_info and task_description
5866
agent.get_goal()
5967
agent.get_description()
6068
agent.get_world_info()
69+
agent.get_task_description()
6170

6271
# set game engine model
6372
# Available models: llama_3_1_405b, deepseek_r1, llama_3_3_70b_instruct, qwen2p5_72b_instruct, deepseek_v3
6473
agent.set_game_engine_model("llama_3_1_405b")
6574

75+
# Set heartbeat
76+
agent.set_main_heartbeat(15)
77+
agent.set_reaction_heartbeat(5)
78+
79+
# check what is current heartbeat
80+
agent.get_main_heartbeat()
81+
agent.get_reaction_heartbeat()
82+
```
83+
84+
### Worker
85+
86+
You can add a worker to the agent. This is useful if you want to run a function on a specific worker.
87+
88+
```python
89+
agent.add_worker(Worker(name="worker-twitter", description="worker for twitter", environment={"NODE_ENV": "production"}))
6690
```
6791

6892
### Functions
@@ -97,6 +121,11 @@ search_function = game.Function(
97121
success_feedback="I found the best songs",
98122
error_feedback="I couldn't find the best songs",
99123
)
124+
worker= Worker( # you can link a worker to the function
125+
name="worker custom search internet",
126+
description="worker for custom search internet",
127+
environment={"NODE_ENV": "production"}
128+
)
100129
)
101130

102131
# adding custom functions only for platform twitter
@@ -205,4 +234,7 @@ pin_message_fn("xxxxxxxx", "xx", "True")
205234
agent.add_custom_function(reply_message_fn)
206235
agent.add_custom_function(create_poll_fn)
207236
agent.add_custom_function(pin_message_fn)
237+
238+
# reset memory
239+
agent.reset_memory()
208240
```

0 commit comments

Comments
 (0)