Metadata-Version: 2.5
Name: huaweicloud-opentelemetry-instrumentation-agentarts-memory
Version: 1.0.0
Summary: Huawei Cloud standalone instrumentation for AgentArts Memory SDK
License-Expression: Apache-2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Requires-Dist: opentelemetry-api==1.39.1
Requires-Dist: opentelemetry-exporter-otlp==1.39.1
Requires-Dist: opentelemetry-instrumentation==0.60b1
Requires-Dist: opentelemetry-sdk==1.39.1
Requires-Dist: opentelemetry-semantic-conventions-ai>=0.5.0
Requires-Dist: wrapt<2.0.0,>=1.0.0
Description-Content-Type: text/x-rst

Huawei Cloud standalone instrumentation for AgentArts Memory SDK
================================================================

OpenTelemetry instrumentation probe for ``agentarts.sdk.memory``. Reports
memory API call traces to APM and window-counted metrics to AOM, without
modifying the AgentArts SDK.

Installation
------------

.. code-block:: sh

   pip install huaweicloud-opentelemetry-instrumentation-memory

Usage
-----

Standalone bootstrap (recommended), e.g. in ``sitecustomize.py``:

.. code-block:: python

   from opentelemetry.instrumentation.huawei_memory import auto_instrument

   auto_instrument()

For langchain integration, use the main package
(``huaweicloud-opentelemetry-instrumentation``) with
``AGENTARTS_AGENTOPS_FRAMEWORK=all``; the memory probe is loaded lazily when
``agentarts.sdk.memory`` is imported.

Supported
---------

- Patch ``agentarts.sdk.memory`` data-plane internal classes (``_DataPlane`` /
  ``_AsyncDataPlane``) with zero code change; span type ``MEMORY``
  (``traceloop.span.type=MEMORY``).
- Traces: one ``memory.{operation}`` CLIENT span per data-plane business call.
- Metrics (window-counted Gauges + duration Histogram):
  ``gen_ai.memory.operation.total`` / ``gen_ai.memory.operation.success`` /
  ``gen_ai.memory.operation.error`` / ``gen_ai.memory.operation.duration``.
- Long/short term memory distinction via the ``gen_ai.memory.type`` attribute
  (``short_term`` / ``long_term``).
- Memory identity attributes: ``gen_ai.memory.session.id`` /
  ``gen_ai.memory.space.id`` / ``gen_ai.memory.endpoint``.
- Input/output capture: ``gen_ai.memory.input.messages`` /
  ``gen_ai.memory.output.messages`` (structured JSON; disable via
  ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false``).
- Generic attributes (``gen_ai.resource.id`` / ``gen_ai.resource.type`` /
  ``gen_ai.conversation.id``) are inherited from the agent context (baggage /
  ``agent_resource_id`` / langgraph ``thread_id``) and are **never overwritten**
  by the memory probe.
- Per-call structured audit log (JSON metadata only, no message content).
