MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / run_code_from_agent

Function run_code_from_agent

utils/wei_utils.py:246–262  ·  view source on GitHub ↗
(agent, msg, num_retries=1)

Source from the content-addressed store, hash-verified

244
245
246def run_code_from_agent(agent, msg, num_retries=1):
247 agent.reset()
248 log = []
249 for attempt in range(num_retries + 1): # +1 to include the initial attempt
250 response = agent.step(msg)
251 code = match_response(response)
252 output, error = run_code(code)
253 log.append((code, output, error))
254
255 if error is None:
256 return log
257
258 if attempt < num_retries:
259 print(f"Retrying... Attempt {attempt + 1} of {num_retries}")
260 msg = error
261
262 return log
263
264def run_modular(all_code, file_name, with_border=True, with_label=True):
265 concatenated_code = utils_functions

Callers

nothing calls this directly

Calls 4

match_responseFunction · 0.85
run_codeFunction · 0.85
resetMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected