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
+25-6Lines changed: 25 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,12 @@
3
3
This is a Python SDK for the Virtuals Twitter Agent. It allows you to configure and deploy agents that can interact with the Twitter/X platform. This SDK/API allows you to configure your agents powered by the GAME architecture. This is similar to configuring your agent in the [Agent Sandbox](https://game-lite.virtuals.io/) on the [Virtuals Platform](https://app.virtuals.io/).
4
4
5
5
## Create an API key
6
+
6
7
Open the [Virtuals Platform](https://app.virtuals.io/) and create/get an API key from the Agent Sandbox by clicking `SDK/API Access`
7
8
8
9

9
10
10
-
Store the key in a safe location, like a `.bashrc` or a `.zshrc` file.
11
+
Store the key in a safe location, like a `.bashrc` or a `.zshrc` file.
Alternatively, you can also use a `.env` file ([`python-dotenv` package](https://github.com/theskumar/python-dotenv) to store and load the key) if you are using the Virtuals Python SDK.
17
18
18
19
## Usage (GAME)
20
+
19
21
The Virtuals SDK current main functionalities are to develop and configure agents powered by GAME. Other functionalities to interact with the Virtuals Platform will be supported in the future. This GAME SDK can be used for multiple use cases:
20
22
21
23
1. Develop, evaluate and update the existing Agent in Twitter environment.
22
-
2. Build on other platforms and application using GAME (Task-based Agent).
24
+
2. Build on other platforms and application using GAME (Task-based Agent).
23
25
24
26
### Update the existing Agent in Twitter environment
27
+
25
28
The SDK provides another interface to configure agents that is more friendly to developers rather than through a UI. This is similar to configuring your agent in the [Agent Sandbox](https://game-lite.virtuals.io/).
26
29
27
30
```python
@@ -35,7 +38,8 @@ agent = Agent(
35
38
world_info="Virtual crypto trading environment where 1 DOGE = 1 DOGE"
36
39
)
37
40
```
38
-
You can also initialize the agent first with just the API key and set the goals, descriptions and world information separately and check the current agent descriptions if needed.
41
+
42
+
You can also initialize the agent first with just the API key and set the goals, descriptions and world information separately and check the current agent descriptions if needed.
# Available models: llama_3_1_405b, deepseek_r1, llama_3_3_70b_instruct, qwen2p5_72b_instruct, deepseek_v3
64
+
agent.set_game_engine_model("llama_3_1_405b")
65
+
57
66
```
58
67
59
68
### Functions
69
+
60
70
By default, there are no functions enabled when the agent is initialized (i.e. the agent has no actions/functions it can execute). There are a list of available and provided functions for the Twitter/X platform and you can set them.
You can then equip the agent with some custom functions. Because the agent is hosted, custom functions need to be wrapped in API calls and can then be defined as follows:
You can simulate one step of the agentic loop on Twitter/X with your new configurations and see the outputs. This is similar to the simulate button on the [Agent Sandbox](https://game-lite.virtuals.io/).
97
109
98
110
```python
99
111
# Simulate one step of the full agentic loop on Twitter/X from the HLP -> LLP -> action (NOTE: supported for Twitter/X only now)
To more realistically simulate deployment, you can also run through the simulate function with the same session id for a number of steps.
103
116
104
117
```python
@@ -118,13 +131,15 @@ response = agent.react(
118
131
```
119
132
120
133
Once you are happy, `deploy_twitter` will push your agent configurations to production and run your agent on Twitter/X autonomously.
134
+
121
135
```python
122
136
# deploy agent! (NOTE: supported for Twitter/X only now)
123
137
agent.deploy_twitter()
124
138
```
125
139
126
140
## Build on other platforms using GAME
127
-
`simulate_twitter` and `deploy_twitter` runs through the entire GAME stack from HLP → LLP→ action/function selected. However, these agent functionalities are currently for the Twitter/X platform. You may utilize Task-based Agent with Low-Level Planner and Reaction Module to develop applications that are powered by GAME. The Low Level Planner (LLP) of the agent (please see [documentation](https://www.notion.so/1592d2a429e98016b389ea26b53686a3?pvs=21) for more details on GAME and LLP) can separately act as a decision making engine based on a task description and event occurring. This agentic architecture is simpler but also sufficient for many applications.
141
+
142
+
`simulate_twitter` and `deploy_twitter` runs through the entire GAME stack from HLP → LLP→ action/function selected. However, these agent functionalities are currently for the Twitter/X platform. You may utilize Task-based Agent with Low-Level Planner and Reaction Module to develop applications that are powered by GAME. The Low Level Planner (LLP) of the agent (please see [documentation](https://www.notion.so/1592d2a429e98016b389ea26b53686a3?pvs=21) for more details on GAME and LLP) can separately act as a decision making engine based on a task description and event occurring. This agentic architecture is simpler but also sufficient for many applications.
128
143
129
144
We are releasing this simpler setup as a more generalised/platform agnostic framework (not specific to Twitter/X). The entire GAME stack along with the HLP will be opened up to be fully configurable and platform agnostic in the coming weeks.
130
145
@@ -150,19 +165,23 @@ response = agent.react(
150
165
## Arguments Definition
151
166
152
167
### Session ID
153
-
The session ID is an identifier for an instance of the agent. When using the same session ID, it maintains and picks up from where it last left off, continuing the session/instance. It should be split per user/ conversation that you are maintaining on your platform. For different platforms, different session ID can be used.
168
+
169
+
The session ID is an identifier for an instance of the agent. When using the same session ID, it maintains and picks up from where it last left off, continuing the session/instance. It should be split per user/ conversation that you are maintaining on your platform. For different platforms, different session ID can be used.
154
170
155
171
### Platform Tag
172
+
156
173
When adding custom functions, and when calling the react agent (i.e. LLP), there is a platform tag that can be defined. This acts like a filter for the functions available that is passed to the agent. You should define the platform when passing in the events.
157
174
158
175
### Task Description
176
+
159
177
Task description serves as the prompt for the agent to respond. Since the reaction can be platform-based, you can define task description based on the platforms. In the task description, you should pass in any related info that require agent to make decision. That should include:
178
+
160
179
- User message
161
180
- Conversation history
162
181
- Instructions
163
182
164
-
165
183
## Importing Functions and Sharing Functions
184
+
166
185
With this SDK and function structure, importing and sharing functions is also possible. Looking forward to all the different contributions and functionalities we will build together as a community!
Copy file name to clipboardExpand all lines: src/game_sdk/hosted_game/agent.py
+16-9Lines changed: 16 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,6 @@ class ContentLLMTemplate:
164
164
top_p: float=0.7
165
165
repetition_penalty: float=1.0
166
166
type: str=None
167
-
taskDescription: str=None
168
167
isSandbox: bool=False
169
168
170
169
def_validate_fields(self):
@@ -190,11 +189,7 @@ def _validate_fields(self):
190
189
self.type=self.template_type
191
190
self.isSandbox=False
192
191
self.userPrompt=self.user_promptor""
193
-
194
-
# Additional settings for REPLY only
195
-
ifself.template_type=="REPLY":
196
-
self.taskDescription=self.taskDescriptionor"Process incoming tweet. Ignore if it is boring or unimportant. Ignore if the conversation has gone too long."
0 commit comments