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

Method __init__

src/virtuals_sdk/game/agent.py:19–43  ·  view source on GitHub ↗
(self,
                 id: str,
                 worker_description: str,
                 get_state_fn: Callable,
                 action_space: List[Function],
                 instruction: Optional[str] = "",
                 )

Source from the content-addressed store, hash-verified

17
18class WorkerConfig:
19 def __init__(self,
20 id: str,
21 worker_description: str,
22 get_state_fn: Callable,
23 action_space: List[Function],
24 instruction: Optional[str] = "",
25 ):
26
27 self.id = id # id or name of the worker
28 # worker description for the TASK GENERATOR (to give appropriate tasks) [NOT FOR THE WORKER ITSELF - WORKER WILL STILL USE AGENT DESCRIPTION]
29 self.worker_description = worker_description
30 self.instruction = instruction
31 self.get_state_fn = get_state_fn
32 self.action_space = action_space
33
34 # setup get state function with the instructions
35 self.get_state_fn = lambda function_result, current_state: {
36 "instructions": self.instruction, # instructions are set up in the state
37 # places the rest of the output of the get_state_fn in the state
38 **get_state_fn(function_result, current_state),
39 }
40
41 self.action_space: Dict[str, Function] = {
42 f.get_function_def()["fn_name"]: f for f in action_space
43 }
44
45
46class Agent:

Callers

nothing calls this directly

Calls 2

get_state_fnFunction · 0.85
get_function_defMethod · 0.80

Tested by

no test coverage detected