remote_mcp_execution
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| RemoteMCPExecutor llmling_agent.resource_providers.codemode.remote_mcp_execution Provides secure code execution with tool access. |
🛈 DocStrings¶
Code execution provider with secure tool isolation via FastAPI server.
RemoteMCPExecutor
dataclass
¶
Provides secure code execution with tool access.
Code Generation mode (ctx-zip style): - Tool functions are generated as Python files inside sandbox - User code imports tools directly, no HTTP server needed - Better for cloud sandboxes (E2B, etc.) that can't reach localhost
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
execution_env
instance-attribute
¶
execution_env: ExecutionEnvironment
Execution environment for running code.
toolset_generator
instance-attribute
¶
toolset_generator: ToolsetCodeGenerator
Code generator for tools.
use_code_generation
class-attribute
instance-attribute
¶
use_code_generation: bool = False
If True, use code generation approach instead of HTTP server.
__aenter__
async
¶
__aenter__()
Async context manager entry.
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
89 90 91 92 | |
__aexit__
async
¶
__aexit__(exc_type, exc_val, exc_tb)
Async context manager exit.
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
94 95 96 | |
execute_code
async
¶
Execute code with tools available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Python code to execute |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Execution result from the environment |
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
78 79 80 81 82 83 84 85 86 87 | |
from_tools
classmethod
¶
from_tools(
tools: Sequence[Tool],
env_config: ExecutionEnvironmentConfig,
include_docstrings: bool = True,
) -> RemoteMCPExecutor
Create provider from tools and environment configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tools
|
Sequence[Tool]
|
Tools to make available for code execution |
required |
env_config
|
ExecutionEnvironmentConfig
|
Execution environment configuration |
required |
include_docstrings
|
bool
|
Include function docstrings in documentation |
True
|
Returns:
| Type | Description |
|---|---|
RemoteMCPExecutor
|
RemoteMCPExecutor instance |
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_tool_description
¶
get_tool_description() -> str
Get comprehensive description of available tools.
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
67 68 69 70 71 72 73 74 75 76 | |
add_numbers
¶
Add two numbers.
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
104 105 106 | |
demo_code_generation_approach
async
¶
demo_code_generation_approach()
Demo new code generation approach (ctx-zip style, works with remote envs).
Source code in src/llmling_agent/resource_providers/codemode/remote_mcp_execution.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |