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

Method compile

src/virtuals_sdk/game/agent.py:88–113  ·  view source on GitHub ↗

Compile the workers for the agent - i.e. set up task generator

(self)

Source from the content-addressed store, hash-verified

86 )
87
88 def compile(self):
89 """ Compile the workers for the agent - i.e. set up task generator"""
90 if not self.workers:
91 raise ValueError("No workers added to the agent")
92
93 workers_list = list(self.workers.values())
94
95 self._map_id = create_workers(
96 self._base_url, self._api_key, workers_list)
97 self.current_worker_id = next(iter(self.workers.values())).id
98
99 # initialize and set up worker states
100 worker_states = {}
101 for worker in workers_list:
102 dummy_function_result = FunctionResult(
103 action_id="",
104 action_status=FunctionResultStatus.DONE,
105 feedback_message="",
106 info={},
107 )
108 worker_states[worker.id] = worker.get_state_fn(
109 dummy_function_result, self.agent_state)
110
111 self.worker_states = worker_states
112
113 return self._map_id
114
115 def reset(self):
116 """ Reset the agent session"""

Callers 1

test_agent.pyFile · 0.80

Calls 2

create_workersFunction · 0.90
FunctionResultClass · 0.90

Tested by

no test coverage detected