MCPcopy Create free account
hub / github.com/Louisym/MiniCC / run_turn_loop

Method run_turn_loop

src/runtime.py:154–167  ·  view source on GitHub ↗
(self, prompt: str, limit: int = 5, max_turns: int = 3, structured_output: bool = False)

Source from the content-addressed store, hash-verified

152 )
153
154 def run_turn_loop(self, prompt: str, limit: int = 5, max_turns: int = 3, structured_output: bool = False) -> list[TurnResult]:
155 engine = QueryEnginePort.from_workspace()
156 engine.config = QueryEngineConfig(max_turns=max_turns, structured_output=structured_output)
157 matches = self.route_prompt(prompt, limit=limit)
158 command_names = tuple(match.name for match in matches if match.kind == 'command')
159 tool_names = tuple(match.name for match in matches if match.kind == 'tool')
160 results: list[TurnResult] = []
161 for turn in range(max_turns):
162 turn_prompt = prompt if turn == 0 else f'{prompt} [turn {turn + 1}]'
163 result = engine.submit_message(turn_prompt, command_names, tool_names, ())
164 results.append(result)
165 if result.stop_reason != 'completed':
166 break
167 return results
168
169 def _infer_permission_denials(self, matches: list[RoutedMatch]) -> list[PermissionDenial]:
170 denials: list[PermissionDenial] = []

Callers 1

mainFunction · 0.80

Calls 5

route_promptMethod · 0.95
QueryEngineConfigClass · 0.85
from_workspaceMethod · 0.80
submit_messageMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected