> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inquantum.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Trace Tools with the Logger SDK

> Wrap external operations and record their inputs, outputs, timing, and errors in Planck.

The helper SDK wraps operations that do not pass through the Planck AI
Gateway. For a raw HTTP integration or a production canary, use the
[cURL guide](/integrations/tools/curl).

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @inquantum/planck-helpers
  ```

  ```bash pip theme={null}
  pip install planck-helpers
  ```
</CodeGroup>

## Log a tool operation

<CodeGroup>
  ```ts TypeScript theme={null}
  import { PlanckManualLogger } from "@inquantum/planck-helpers";

  const logger = new PlanckManualLogger({
    apiKey: process.env.PLANCK_API_KEY!,
    throwOnError: true,
  });

  const result = await logger.logRequest(
    {
      _type: "tool",
      toolName: "weather_api",
      input: { location: "Bogotá, Colombia" },
    },
    async (recorder) => {
      const response = await fetch(
        "https://weather.example/current?location=Bogota",
      );
      const body = await response.json();
      recorder.appendResults(body);
      return body;
    },
    {
      "Planck-Session-Id": "user-123",
      "Planck-Property-Environment": "production",
    },
    "custom",
  );
  ```

  ```python Python theme={null}
  import os
  import requests

  from planck_helpers import PlanckManualLogger

  with PlanckManualLogger(
      api_key=os.environ["PLANCK_API_KEY"],
      raise_on_error=True,
  ) as logger:
      def call_weather(recorder):
          response = requests.get(
              "https://weather.example/current",
              params={"location": "Bogotá, Colombia"},
              timeout=10,
          )
          response.raise_for_status()
          body = response.json()
          recorder.append_results(body)
          return body

      result = logger.log_request(
          request={
              "_type": "tool",
              "toolName": "weather_api",
              "input": {"location": "Bogotá, Colombia"},
          },
          operation=call_weather,
          additional_headers={
              "Planck-Session-Id": "user-123",
              "Planck-Property-Environment": "production",
          },
          provider="custom",
      )
  ```
</CodeGroup>

The wrapper logs successful results and failed operations. By default, logging
is best-effort so a telemetry outage does not fail your application. Use
`throwOnError: true` in TypeScript or `raise_on_error=True` in Python when a
missing log should fail the operation.

The default base URL is `https://api.inquantum.ai`. Self-hosted or regional
deployments can override `loggingEndpoint` in TypeScript or `logging_endpoint`
in Python.

## Related documentation

* [Manual logging with cURL](/integrations/tools/curl)
* [Custom properties](/features/advanced-usage/custom-properties)
