Initialize the interpreter. Args: mcp_client: MCP client for tool invocation. tools: List of available tools. llm_client: LLMClient for LLM calls (supports multiple providers via LiteLLM). usage_tracker: Optional dict for tracking tok
(self, mcp_client, tools, llm_client, usage_tracker=None)
| 85 | """ |
| 86 | |
| 87 | def __init__(self, mcp_client, tools, llm_client, usage_tracker=None): |
| 88 | """ |
| 89 | Initialize the interpreter. |
| 90 | |
| 91 | Args: |
| 92 | mcp_client: MCP client for tool invocation. |
| 93 | tools: List of available tools. |
| 94 | llm_client: LLMClient for LLM calls (supports multiple providers via LiteLLM). |
| 95 | usage_tracker: Optional dict for tracking token usage. |
| 96 | If None, creates a default tracker. |
| 97 | """ |
| 98 | if usage_tracker is None: |
| 99 | usage_tracker = { |
| 100 | "prompt_tokens_total": 0, |
| 101 | "completion_tokens_total": 0, |
| 102 | "reasoning_tokens_total": 0, |
| 103 | "cost_total": 0.0, |
| 104 | } |
| 105 | |
| 106 | self.mcp_client = mcp_client |
| 107 | self.tools = tools |
| 108 | |
| 109 | # Convenience functions for file operations |
| 110 | self.mcp_fs_write = self.mcp_client.make_mcp_tool_function( |
| 111 | "fs_write", ["path", "content"] |
| 112 | ) |
| 113 | self.mcp_fs_read = self.mcp_client.make_mcp_tool_function( |
| 114 | "fs_read", ["path", "max_bytes"] |
| 115 | ) |
| 116 | |
| 117 | self.llm_executor: LLMExecutor = LLMExecutor( |
| 118 | mcp_client=mcp_client, |
| 119 | tools=tools, |
| 120 | llm_client=llm_client, |
| 121 | usage_tracker=usage_tracker, |
| 122 | ) |
| 123 | # Set back-reference so LLMExecutor can delegate submodule calls |
| 124 | self.llm_executor.interpreter = self |
| 125 | |
| 126 | def _load_submodule_tools_for_yaml( |
| 127 | self, yaml_data: Dict[str, Any], yaml_file_path: str |
nothing calls this directly
no test coverage detected