Skip to content
Connect AI Assets

SAP Cloud SDK for AI (JavaScript) ​

For JavaScript/TypeScript agents built on the SAP Cloud SDK for AI, instrument with the standard OpenTelemetry Node SDK and emit the GenAI attributes Boidra Platform reads. The key is the same as every other path: export OTLP/HTTP to the Boidra Platform /otel endpoint.

The SAP AI SDK's own instrumentation surface evolves upstream — consult the SAP Cloud SDK for AI docs for SDK-specific details. This page covers the Boidra Platform-specific wiring.

1. Configure the exporter ​

bash
export OTEL_EXPORTER_OTLP_ENDPOINT="https://<your-dashboard-host>/otel"
# The OpenTelemetry JS OTLP/HTTP exporter targets /v1/traces under this endpoint.

The Node OpenTelemetry OTLP/HTTP exporter uses HTTP by default, so no protocol override is needed (unlike the Python SDK).

2. Set up tracing ​

ts
import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

const sdk = new NodeSDK({
  traceExporter: new OTLPTraceExporter({
    // Defaults to OTEL_EXPORTER_OTLP_ENDPOINT + /v1/traces
    url: `${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`,
  }),
});
sdk.start();

3. Emit agent / chat / tool spans ​

Wrap your agent turns and set the GenAI attributes:

ts
import { trace } from "@opentelemetry/api";

const tracer = trace.getTracer("my-agent");

await tracer.startActiveSpan("invoke_agent support-agent", async (span) => {
  span.setAttributes({
    "gen_ai.operation.name": "invoke_agent",
    "gen_ai.agent.name": "support-agent",
    "gen_ai.request.model": "gpt-4o",
    "gen_ai.usage.input_tokens": 1200,
    "gen_ai.usage.output_tokens": 340,
  });
  try {
    // ... your agent logic (LLM + tool calls) ...
  } finally {
    span.end();
  }
});

For tool calls, set gen_ai.operation.name = "execute_tool" and gen_ai.tool.name; for LLM calls, gen_ai.operation.name = "chat" with the model and token attributes. See the OpenTelemetry SDK page for the full per-span-type attribute set — it applies identically here.

Verify ​

Run your agent and check the dashboard's Traces page / Live tab. If spans don't arrive, confirm the exporter URL ends in /otel/v1/traces and that your process actually flushes spans before exiting (the NodeSDK batches by default).

Boidra — multi-agent AI systems in the SAP ecosystem.