You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/game_sdk/hosted_game/README.md
+36-4Lines changed: 36 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,12 +30,18 @@ The SDK provides another interface to configure agents that is more friendly to
30
30
```python
31
31
from game_sdk.hosted_game.agent import Agent
32
32
33
+
34
+
33
35
# 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
+
34
39
agent = Agent(
35
40
api_key=VIRTUALS_API_KEY,
36
41
goal="Autonomously analyze crypto markets and provide trading insights",
37
42
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."
39
45
)
40
46
```
41
47
@@ -44,25 +50,43 @@ You can also initialize the agent first with just the API key and set the goals,
44
50
```python
45
51
agent = Agent(api_key=VIRTUALS_API_KEY)
46
52
47
-
# check what is current goal, descriptionsand world_info
53
+
# check what is current goal, descriptions, world_info and task_description
48
54
agent.get_goal()
49
55
agent.get_description()
50
56
agent.get_world_info()
57
+
agent.get_task_description()
51
58
52
-
# Set components individually - set change the agent goal/description/worldinfo
59
+
# Set components individually - set change the agent goal/description/worldinfo/task_description
53
60
agent.set_goal("Autonomously analyze crypto markets and provide trading insights")
54
61
agent.set_description("HODL-9000: A meme-loving trading bot powered by hopium and ramen")
55
62
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.")
56
64
57
-
# check what is current goal, descriptionsand world_info
65
+
# check what is current goal, descriptions, world_info and task_description
58
66
agent.get_goal()
59
67
agent.get_description()
60
68
agent.get_world_info()
69
+
agent.get_task_description()
61
70
62
71
# set game engine model
63
72
# Available models: llama_3_1_405b, deepseek_r1, llama_3_3_70b_instruct, qwen2p5_72b_instruct, deepseek_v3
64
73
agent.set_game_engine_model("llama_3_1_405b")
65
74
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"}))
0 commit comments