Skip to main content

LoongSuite Hermes Agent instrumentation

Project description

LoongSuite Hermes Agent Instrumentation

LoongSuite instrumentation for Hermes Agent.

Features

  • Agent tracing: invoke_agent Hermes spans for top-level agent runs
  • ReAct step tracing: react step spans for each Hermes reasoning round
  • LLM tracing: model request/response spans with token usage and TTFT
  • Tool tracing: execute_tool spans for Hermes tool calls
  • Content capture controls: honors OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT

Installation

# Step 1: install LoongSuite distro
pip install loongsuite-distro

# Step 2 (Option C): install this instrumentation from PyPI
pip install loongsuite-instrumentation-hermes-agent

# Optional app dependency
pip install hermes-agent

Usage

Auto-instrumentation

export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY

loongsuite-instrument python your_hermes_app.py

Manual instrumentation

from opentelemetry.instrumentation.hermes_agent import HermesAgentInstrumentor
from run_agent import AIAgent

HermesAgentInstrumentor().instrument()

agent = AIAgent(
    model="qwen-turbo",
    provider="dashscope",
    quiet_mode=True,
)
result = agent.run_conversation("Hello from Hermes")

HermesAgentInstrumentor().uninstrument()

Configuration

Export to OTLP Backend

export OTEL_SERVICE_NAME=my-hermes-app
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=<trace_endpoint>
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=<metrics_endpoint>

loongsuite-instrument python your_hermes_app.py

Content Capture

export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental

# Capture content in spans only
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY

# Disable content capture
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=NO_CONTENT

Supported Signals

  • AGENT: top-level Hermes agent invocation
  • ENTRY: AI application entry spans when Hermes resolves an entry source from AIAgent.platform, HERMES_SESSION_SOURCE, or the default cli source used by platform-less AIAgent instances. Every top-level instrumented AIAgent.run_conversation now emits ENTRY -> AGENT.
  • STEP: Hermes ReAct step lifecycle
  • LLM: synchronous and streaming model calls
  • TOOL: Hermes tool execution, including tool call id, arguments, and result

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file loongsuite_instrumentation_hermes_agent-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for loongsuite_instrumentation_hermes_agent-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c5b12d8801d950aebbd3f8b3672e75da8357f0cc938eb93a8a9846f10b24ef4
MD5 739e9a6e5583d552ffcfa58dbc26498d
BLAKE2b-256 3f4b6df25485995294d503dc5f4fbfcc4db43f3cb313c4292b7a4e8249d051aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page