Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AMAP ML SkillClaw run llm

From Leeroopedia
Knowledge Sources
Domains LLM_Client, Utility
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for synchronous LLM chat completions with provider routing (OpenAI or AWS Bedrock), provided by the SkillClaw client package.

Description

The run_llm function is a synchronous utility used by the proxy for system prompt compression and other one-off LLM calls. It routes to either `_run_llm_openai` (standard OpenAI-compatible API) or `_run_llm_bedrock` (AWS Bedrock via BedrockChatClient) based on the config's LLM provider setting. Unlike AsyncLLMClient, this is blocking and intended for use within `asyncio.to_thread` calls.

Usage

Import and use when you need to:

  • Make synchronous LLM calls from the proxy server
  • Compress system prompts for OpenClaw
  • Route between OpenAI and Bedrock providers

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `skillclaw/utils.py:L48-53`

Signature

def run_llm(messages, config: Optional["SkillClawConfig"] = None) -> str:
    """Run a synchronous LLM chat completion.

    Routes to _run_llm_openai or _run_llm_bedrock based on config provider.
    Returns the assistant response content text.
    """

Import

from skillclaw.utils import run_llm

I/O Contract

Inputs

Name Type Required Description
messages list[dict] Yes /// Chat messages
config None No /// Config (determines provider, API keys)

Outputs

Name Type Description
Returns str Assistant response content

Usage Examples

System Prompt Compression

from skillclaw.utils import run_llm
import asyncio

# Compress a verbose system prompt (used by SkillClawAPIServer)
compressed = asyncio.run(asyncio.to_thread(
    run_llm,
    [{"role": "user", "content": verbose_system_prompt}],
    config,
))

Related Pages

Implements Principle

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment