Path

Install the Agent Observability SDK for your language, create the client with no arguments, and run the manual-capture sample to send your first generation.

Estimated time: 3 min

Install the SDK and capture a generation

This milestone happens on your machine, in the shell from Milestone 4. Install the SDK, copy the capture sample from your language page, and change only how the client is created so it reads those variables.

  1. Run the install command for your language in the shell from Milestone 4.

    LanguageInstall command
    Pythonpip install agento11y
    TypeScript and JavaScriptnpm install @grafana/agento11y
    Gogo get github.com/grafana/agento11y/go
    JavaAdd the com.grafana.agento11y:agento11y-core Maven dependency. The Java install snippet does not state a version, so check Maven Central for the current agento11y-core version before you add it.
    .NETdotnet add package Grafana.Agento11y and dotnet add package Grafana.Agento11y.OpenAI
  2. In the following table, click the link for the language you are using and locate the code sample.

  3. Copy the code sample into a file you can run.

    The Python, TypeScript and JavaScript, and Go samples run as copied. The Java sample is a fragment, so wrap it in a class with a main method and add imports for the com.grafana.agento11y types it uses. The .NET sample uses an openAIClient and inputItems it doesn’t define, so create an OpenAI client with your provider key and a list of input items before the OpenAIRecorder.CreateResponseAsync call.

  4. Change how the client is created so it reads the variables from Milestone 4.

    Find the lines that create the client. They include the endpoint. Replace them with the one line for your language in the following table, which is also under Use environment variables instead on the same page. Leave every other line as it is, including the shutdown call.

    For example, in Python, replace:

    Python
    client = Client(
        ClientConfig(
            generation_export_endpoint="{AGENTO11Y_ENDPOINT}",
        )
    )

    with:

    Python
    client = Client()

    The import line and the rest of the sample stay as they are. ClientConfig in the import is unused after this change, and leaving it there is fine.

    LanguageClient
    Pythonclient = Client()
    TypeScript and JavaScriptconst client = new Agento11yClient();
    Goclient := agento11y.NewClient(agento11y.Config{})
    JavaAgento11yClient client = new Agento11yClient();
    .NETvar client = new Agento11yClient();
  5. Run the file from the shell where you set the variables.

    The Python, TypeScript and JavaScript, Go, and Java samples don’t call an LLM provider, so no provider key is needed. Each records one generation: conversation conv-1, model openai/gpt-4o, and the assistant message Hello.

    The .NET sample calls the OpenAI provider helper, so run it with your provider key.

The SDK for your language is installed, and you have captured a generation.