Skip to content

runtime

Class info

Classes

Name Children Inherits
ResourceInfo
llmling_agent.models.resources
Information about an available resource.
    ResourceProvider
    llmling_agent.resource_providers.base
    Base class for resource providers.
    RuntimeResourceProvider
    llmling_agent.resource_providers.runtime
    Provider that exposes RuntimeConfig tools through ResourceProvider interface.
      ToolInfo
      llmling_agent.tools.base
      Information about a registered tool.

        🛈 DocStrings

        Provider for RuntimeConfig tools.

        RuntimeResourceProvider

        Bases: ResourceProvider

        Provider that exposes RuntimeConfig tools through ResourceProvider interface.

        Source code in src/llmling_agent/resource_providers/runtime.py
        20
        21
        22
        23
        24
        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
        class RuntimeResourceProvider(ResourceProvider):
            """Provider that exposes RuntimeConfig tools through ResourceProvider interface."""
        
            def __init__(self, runtime: RuntimeConfig, name: str = "runtime") -> None:
                """Initialize provider with RuntimeConfig.
        
                Args:
                    runtime: RuntimeConfig instance to wrap
                    name: Name of the provider
                """
                super().__init__(name=name)
                self._runtime = runtime
        
            async def get_tools(self) -> list[ToolInfo]:
                """Convert RuntimeConfig tools to ToolInfos."""
                tools: list[ToolInfo] = []
        
                for tool in self._runtime.get_tools():
                    try:
                        tools.append(ToolInfo(tool, source="runtime"))
                    except Exception:
                        logger.exception("Failed to convert runtime tool: %s", tool.name)
                        continue
        
                return tools
        
            async def get_prompts(self) -> list[BasePrompt]:
                """Get prompts from runtime."""
                return list(self._runtime.get_prompts())
        
            async def get_resources(self) -> list[ResourceInfo]:
                """Convert runtime resources to ResourceInfo."""
                resources: list[ResourceInfo] = []
        
                for resource in self._runtime.get_resources():
                    try:
                        name = resource.name or str(resource.uri)
                        uri = str(resource.uri)
                        info = ResourceInfo(name=name, uri=uri, description=resource.description)
                        resources.append(info)
                    except Exception:
                        logger.exception("Failed to convert runtime resource: %s", resource.name)
                        continue
        
                return resources
        

        __init__

        __init__(runtime: RuntimeConfig, name: str = 'runtime') -> None
        

        Initialize provider with RuntimeConfig.

        Parameters:

        Name Type Description Default
        runtime RuntimeConfig

        RuntimeConfig instance to wrap

        required
        name str

        Name of the provider

        'runtime'
        Source code in src/llmling_agent/resource_providers/runtime.py
        23
        24
        25
        26
        27
        28
        29
        30
        31
        def __init__(self, runtime: RuntimeConfig, name: str = "runtime") -> None:
            """Initialize provider with RuntimeConfig.
        
            Args:
                runtime: RuntimeConfig instance to wrap
                name: Name of the provider
            """
            super().__init__(name=name)
            self._runtime = runtime
        

        get_prompts async

        get_prompts() -> list[BasePrompt]
        

        Get prompts from runtime.

        Source code in src/llmling_agent/resource_providers/runtime.py
        46
        47
        48
        async def get_prompts(self) -> list[BasePrompt]:
            """Get prompts from runtime."""
            return list(self._runtime.get_prompts())
        

        get_resources async

        get_resources() -> list[ResourceInfo]
        

        Convert runtime resources to ResourceInfo.

        Source code in src/llmling_agent/resource_providers/runtime.py
        50
        51
        52
        53
        54
        55
        56
        57
        58
        59
        60
        61
        62
        63
        64
        async def get_resources(self) -> list[ResourceInfo]:
            """Convert runtime resources to ResourceInfo."""
            resources: list[ResourceInfo] = []
        
            for resource in self._runtime.get_resources():
                try:
                    name = resource.name or str(resource.uri)
                    uri = str(resource.uri)
                    info = ResourceInfo(name=name, uri=uri, description=resource.description)
                    resources.append(info)
                except Exception:
                    logger.exception("Failed to convert runtime resource: %s", resource.name)
                    continue
        
            return resources
        

        get_tools async

        get_tools() -> list[ToolInfo]
        

        Convert RuntimeConfig tools to ToolInfos.

        Source code in src/llmling_agent/resource_providers/runtime.py
        33
        34
        35
        36
        37
        38
        39
        40
        41
        42
        43
        44
        async def get_tools(self) -> list[ToolInfo]:
            """Convert RuntimeConfig tools to ToolInfos."""
            tools: list[ToolInfo] = []
        
            for tool in self._runtime.get_tools():
                try:
                    tools.append(ToolInfo(tool, source="runtime"))
                except Exception:
                    logger.exception("Failed to convert runtime tool: %s", tool.name)
                    continue
        
            return tools