MCPcopy Create free account
hub / github.com/Virtual-Protocol/virtuals-python / Agent

Class Agent

src/virtuals_sdk/twitter_agent/agent.py:157–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156
157class Agent:
158 def __init__(
159 self,
160 api_key: str,
161 goal: str = "",
162 description: str = "",
163 world_info: str = "",
164 main_heartbeat: int = 15,
165 reaction_heartbeat: int = 5
166 ):
167 self.game_sdk = sdk.GameSDK(api_key)
168 self.goal = goal
169 self.description = description
170 self.world_info = world_info
171 self.enabled_functions: List[str] = []
172 self.custom_functions: List[Function] = []
173 self.main_heartbeat = main_heartbeat
174 self.reaction_heartbeat = reaction_heartbeat
175
176 def set_goal(self, goal: str):
177 self.goal = goal
178 return True
179
180 def set_description(self, description: str):
181 self.description = description
182 return True
183
184 def set_world_info(self, world_info: str):
185 self.world_info = world_info
186 return True
187
188 def set_main_heartbeat(self, main_heartbeat: int):
189 self.main_heartbeat = main_heartbeat
190 return True
191
192 def set_reaction_heartbeat(self, reaction_heartbeat: int):
193 self.reaction_heartbeat = reaction_heartbeat
194 return True
195
196 def get_goal(self) -> str:
197 return self.goal
198
199 def get_description(self) -> str:
200 return self.description
201
202 def get_world_info(self) -> str:
203 return self.world_info
204
205 def list_available_default_twitter_functions(self) -> Dict[str, str]:
206 """
207 List all of the default functions (currently default functions are only available for Twitter/X platform)
208 TODO: will be moved to another layer of abstraction later
209 """
210 # Combine built-in and custom function descriptions
211 return self.game_sdk.functions()
212
213 def use_default_twitter_functions(self, functions: List[str]):
214 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected