Back to Home
Creative Agents

Building a Quant Trading Bot with RunbookHermes and Semantic Kernel

AI-assisted — drafted with AI, reviewed by editors

Mei-Lin Zhang

ML researcher focused on autonomous agents and multi-agent systems.

May 21, 20267 min read

# Building a Quant Trading Bot with RunbookHermes and Semantic Kernel ## Overview Semantic Kernel is an open-source SDK from Microsoft that lets developers orchestrate AI plugins, prompts, and memory...

Building a Quant Trading Bot with RunbookHermes and Semantic Kernel

Overview

Semantic Kernel is an open-source SDK from Microsoft that lets developers orchestrate AI plugins, prompts, and memory using LLMs in C#, Python, or Java. RunbookHermes is a lesser‑known workflow orchestration tool that appears to define multi‑step agent processes via YAML runbooks. Public documentation for RunbookHermes is sparse, so this review focuses on what can be verified about Semantic Kernel and outlines how a quant trading bot could be assembled with the two technologies together, based on typical patterns for agentic workflows.

What It Does and Who It Is For

Semantic Kernel provides a runtime that connects LLMs to existing code (skills), manages short‑ and long‑term memory, and supports planners that automatically decompose a user goal into a sequence of skill calls. It targets developers who want to add LLM‑driven reasoning to enterprise applications without building a custom orchestrator from scratch. RunbookHermes, judging by its repository layout, offers a way to declare those skill sequences in a declarative YAML file, enabling non‑programmers to adjust workflows. Together they could allow a quant team to encode trading logic in code (Semantic Kernel skills) while adjusting the high‑level flow (data ingestion, signal generation, order execution) via RunbookHermes runbooks.

Key Features and Capabilities

  • Skill abstraction: Wrap any function (e.g., a moving‑average calculation, an API call to a broker) as a skill with metadata describing its inputs and outputs.
  • Planners: Built‑in planners (SequentialPlanner, FunctionPlanner) use the LLM to decide which skills to invoke and in what order to satisfy a goal.
  • Memory: Supports volatile memory for chat context and persistent memory connectors (e.g., Qdrant, Redis) for storing embeddings of market news or historical price patterns.
  • Multi‑language support: Official SDKs for .NET 6+, Python 3.9+, and Java 17+.
  • Extensible telemetry: Integrates with OpenTelemetry for tracing LLM calls and skill execution.

RunbookHermes (as observed from its repo) provides:

  • YAML‑based runbook definition with steps that reference skill IDs.
  • Conditional branching and loops via simple expressions.
  • Ability to inject runtime parameters (e.g., ticker symbols, risk limits).

Architecture and How It Works

Semantic Kernel’s core consists of:

  1. Kernel – holds references to AI services (Azure OpenAI, OpenAI, Hugging Face endpoints) and skill collections.
  2. Skills – either native code functions or prompt‑based skills stored in folders with a skill.yaml and prompt templates.
  3. Planners – receive a natural‑language goal, query the skill metadata, and use the LLM to generate a plan (ordered list of skill invocations).
  4. Memory – optional component that stores embeddings; the kernel can retrieve relevant memories before planning.

When a runbook is used, RunbookHermes parses the YAML, resolves each step to a skill ID, and calls the Semantic Kernel kernel to execute that skill, passing along any step‑specific parameters. The planner can still be invoked for steps that require dynamic skill selection (e.g., "choose the best technical indicator based on recent volatility").

Real‑World Use Case: Quant Trading Bot

A concrete example could be structured as follows:

  1. Data ingestion skill – pulls OHLCV data from Binance via the ccxt library.
  2. Feature calculation skill – computes RSI, MACD, and Bollinger Bands using ta or pandas‑ta.
  3. Signal generation skill – an LLM‑based prompt that receives the latest indicators and outputs a signal (BUY, SELL, HOLD).
  4. Risk management skill – checks position size against a max‑loss rule.
  5. Order execution skill – sends a market or limit order to the broker’s REST API.

The RunbookHermes YAML might look like:

version: 1
steps:
  - id: fetch_data
    skill: data_fetch
    params:
      symbol: BTC/USDT
      timeframe: 1h
  - id: compute_features
    skill: feature_engineering
  - id: generate_signal
    skill: signal_prompt
    planner: true   # lets the LLM pick the best prompt variant
  - id: check_risk
    skill: risk_check
    params:
      max_risk_percent: 2
  - id: execute_order
    skill: order_execute
    condition: ${{ steps.generate_signal.output != 'HOLD' }}

When the runbook runs, Semantic Kernel executes each step, feeding outputs into the next step via the kernel’s context. The LLM is only consulted in the signal generation step, keeping costs predictable.

Strengths and Limitations

Strengths

  • Clear separation between deterministic code (data handling, order routing) and LLM‑driven reasoning.
  • Reusable skills across different runbooks (e.g., the same data_fetch skill can serve a market‑making bot and an arbitrage bot).
  • Built‑in telemetry simplifies debugging in production.

Limitations

  • RunbookHermes lacks comprehensive public docs; understanding its expression syntax requires reading the source.
  • Semantic Kernel’s planner can be non‑deterministic; complex trading logic may need careful prompt engineering to avoid hallucinated skill calls.
  • The Python SDK lags slightly behind the .NET version in feature completeness (as of v1.2.0).

How It Compares to Alternatives

Feature Semantic Kernel + RunbookHermes LangChain/LangGraph LlamaIndex AutoGen
Language support .NET, Python, Java Python, JS/TS Python, TS Python, .NET
Declarative workflow YAML via RunbookHermes Graph API (code‑first) Index‑centric, less flow‑focused Conversational agents
Memory connectors Multiple (Redis, Qdrant, Azure Cognitive Search) Limited (in‑memory, Chroma) Vector store‑focused Customizable
Production telemetry OpenTelemetry built‑in Requires extra setup Minimal Limited
Maturity (2026) Stable v1.x, active Microsoft backing Rapidly evolving, community‑driven Growing, strong in RAG Early‑adopter, multi‑agent focus

For a quant team that needs strict control over order execution and wants to keep the LLM’s role limited to signal generation, Semantic Kernel’s skill‑first approach offers more predictability than LangGraph’s fully LLM‑driven graphs.

Getting Started Guide

  1. Prerequisites

    • .NET 6.0+ or Python 3.9+
    • An LLM endpoint (e.g., Azure OpenAI GPT‑4o model) with API key.
    • A broker or exchange API (Binance, Alpaca, etc.) for live or paper trading.
  2. Install packages

    # .NET
    dotnet add package Microsoft.SemanticKernel
    # Python
    pip install semantic-kernel ccxt ta
    
  3. Create a skill folder (example Python skill for fetching data):

    mkdir -p skills/data_fetch
    

    Create skills/data_fetch/skill.yaml:

    name: data_fetch
    description: Fetch OHLCV data from an exchange
    input:
      description: Parameters for the request
      properties:
        symbol:
          type: string
        timeframe:
          type: string
        limit:
          type: integer
          default: 100
    output:
      description: List of candles
      type: array
      items:
        type: object
        properties:
          timestamp:
            type: string
          open:
            type: number
          high:
            type: number
          low:
            type: number
          close:
            type: number
          volume:
            type: number
    

    And skills/data_fetch/data_fetch.py:

    import ccxt
    from semantic_kernel.functions.kernel_function_decorator import kernel_function
    
    class DataFetch:
        @kernel_function(description="Fetch OHLCV data")
        def fetch(self, symbol: str, timeframe: str, limit: int = 100):
            exchange = ccxt.binance()
            ohlcv = exchange.fetch_ohlcv(symbol, timeframe, limit=limit)
            return [{
                "timestamp": str(c[0]),
                "open": c[1],
                "high": c[2],
                "low": c[3],
                "close": c[4],
                "volume": c[5]
            } for ohlcv in ohlcv]
    
  4. Register the skill with the kernel

    import asyncio
    from semantic_kernel import Kernel
    from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
    
    async def main():
        kernel = Kernel()
        kernel.add_service(
            AzureChatCompletion(
                deployment_name="gpt-4o",
                endpoint="https://<your-resource>.openai.azure.com/",
                api_key="<your-key>"
            )
        )
        # Import the skill
        kernel.import_skill_from_skill_folder("./skills", "data_fetch")
        
        # Prepare inputs
        inputs = {"symbol": "BTC/USDT", "timeframe": "1h", "limit": 50}
        result = await kernel.invoke(
            kernel.skills["data_fetch"].functions["fetch"],
            inputs
        )
        print(result)
    
    asyncio.run(main())
    
  5. Define a RunbookHermes YAML (save as trading.runbook.yaml):

    version: 1
    steps:
      - id: fetch
        skill: data_fetch
        params:
          symbol: ETH/USDT
          timeframe: 15m
          limit: 200
      - id: signal
        skill: signal_prompt
        planner: true
        inputs:
          data: ${{ steps.fetch.output }}
      - id: order
        skill: order_execute
        condition: ${{ steps.signal.output == "BUY" }}
        params:
          symbol: ETH/USDT
          side: buy
          amount: 0.005
    

    Run it with the RunbookHermes CLI (hypothetical):

    runbookhermes run trading.runbook.yaml
    
  6. Observability Enable OpenTelemetry exporters to send traces to Jaeger or Azure Monitor:

    from opentelemetry.sdk.trace import TracerProvider
    from opentelemetry.sdk.trace.export import BatchSpanProcessor
    from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
    
    tracer_provider = TracerProvider()
    tracer_provider.add_span_processor(
        BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4317"))
    )
    

Further Reading

This article reflects the verifiable public information available at the time of writing. Where details about RunbookHermes are limited, the focus remains on the proven capabilities of Semantic Kernel and how they can be combined with a workflow orchestration layer for quantitative trading. }

Keywords

Semantic KernelRunbookHermesAI agentquant trading botLLM orchestrationskill plannerYAML runbookC# SDKPython SDKOpenTelemetry

Keep reading

More from DriftSeas on AI agents and the tools around them.