> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/langfuse.md).

# Langfuse

Integrate Langfuse project observability, prompts, datasets, and scores.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication     |
| --------- | ------------------ |
| Langfuse  | Project Secret Key |

#### Langfuse

Connect a Langfuse project with its public key, secret key, and deployment URL.

**Set up in Langfuse**

1. Prepare the Langfuse account or service that the workflow will access. Grant access to the required resources and operations.
2. **Project Public Key:** Copy the public key from Langfuse Project Settings.
3. **Project Secret Key:** Copy the secret key from Langfuse Project Settings.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Langfuse**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field      | Required                 | What to enter                                            |
| ------------------ | ------------------------ | -------------------------------------------------------- |
| Project Public Key | Yes                      | Copy the public key from Langfuse Project Settings.      |
| Project Secret Key | Yes                      | Copy the secret key from Langfuse Project Settings.      |
| Langfuse Base URL  | Optional / as applicable | Your Langfuse regional or self-hosted deployment origin. |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Langfuse** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Ingest Trace Events

Send a completed trace and optional child observations to Langfuse.

**Inputs**

| Field      | Type     | Required | Description                                                  |
| ---------- | -------- | -------- | ------------------------------------------------------------ |
| Trace Name | string   | Yes      | A recognizable name for the traced workflow or request.      |
| Input      | textarea | No       | The input captured for this trace.                           |
| Output     | textarea | No       | The output produced by this trace.                           |
| Start Time | datetime | No       | When the traced operation started.                           |
| End Time   | datetime | No       | When the traced operation finished.                          |
| Options    | object   | No       | Optional trace identifiers, context, and child observations. |

**Outputs**

| Field           | Type          | Description                                              |
| --------------- | ------------- | -------------------------------------------------------- |
| Trace ID        | string        | The OTLP trace identifier accepted by Langfuse.          |
| Root Span ID    | string        | The root observation identifier accepted by Langfuse.    |
| Accepted        | boolean       | Whether Langfuse accepted the export.                    |
| Observation IDs | object\_array | The root and child observation keys with their span IDs. |

#### List Traces

List recent Langfuse trace summaries.

**Inputs**

| Field          | Type    | Required | Description                                                       |
| -------------- | ------- | -------- | ----------------------------------------------------------------- |
| Maximum Traces | integer | No       | The maximum number of trace summaries to return. Default: 50.     |
| Trace Name     | string  | No       | Return traces with this parent trace name.                        |
| Options        | object  | No       | Optional trace identifiers, time bounds, filters, and pagination. |

**Outputs**

| Field           | Type          | Description                                                   |
| --------------- | ------------- | ------------------------------------------------------------- |
| Trace Summaries | object\_array | Typed summaries derived from logical root observations.       |
| Next Cursor     | string        | The cursor for the next page, when more traces are available. |

#### Create Score

Attach a score to Langfuse data.

**Inputs**

| Field        | Type            | Required | Description                                                                                                       |
| ------------ | --------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| Score Target | select (string) | Yes      | The kind of Langfuse record being scored. Available values: Trace, Observation, Session, Dataset Run.             |
| Target ID    | string          | Yes      | The exact ID of the trace, observation, session, or dataset run.                                                  |
| Score Name   | string          | Yes      | The metric or judgment represented by this score.                                                                 |
| Data Type    | select (string) | Yes      | How Langfuse should interpret the score value. Available values: Numeric, Boolean, Categorical, Correction, Text. |
| Value        | string          | Yes      | The score value in the format required by its data type.                                                          |
| Comment      | textarea        | No       | Context explaining why this score was assigned.                                                                   |
| Environment  | string          | No       | The environment associated with this score.                                                                       |
| Score ID     | string          | No       | A stable custom ID for idempotent retries or updates.                                                             |

**Outputs**

| Field    | Type   | Description                             |
| -------- | ------ | --------------------------------------- |
| Score ID | string | The ID of the created or updated score. |

#### Get Prompt

Fetch a text or chat prompt by name, label, or version.

**Inputs**

| Field                | Type            | Required | Description                                                                 |
| -------------------- | --------------- | -------- | --------------------------------------------------------------------------- |
| Prompt               | select (string) | Yes      | The Langfuse prompt to retrieve. Options load from the selected connection. |
| Label                | string          | No       | A deployment label such as production or staging.                           |
| Version              | integer         | No       | A specific positive prompt version.                                         |
| Resolve Dependencies | boolean         | No       | Replace referenced prompt dependencies with their content. Default: true.   |

**Outputs**

| Field   | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| Prompt  | object  | The returned text or chat prompt with its Langfuse metadata. |
| Name    | string  | The resolved prompt name.                                    |
| Version | integer | The resolved prompt version.                                 |
| Type    | string  | Whether the prompt is text or chat.                          |

#### Create Dataset Item

Add or update an example in a Langfuse dataset.

**Inputs**

| Field                | Type            | Required | Description                                                                                    |
| -------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------- |
| Dataset              | select (string) | Yes      | The Langfuse dataset that should receive this item. Options load from the selected connection. |
| Input JSON           | textarea        | Yes      | The example input that a model or workflow should process.                                     |
| Expected Output JSON | textarea        | No       | The desired answer or result for this example.                                                 |
| Options              | object          | No       | Optional metadata, source references, item ID, and status.                                     |

**Outputs**

| Field        | Type   | Description                                  |
| ------------ | ------ | -------------------------------------------- |
| Dataset Item | object | The typed dataset item returned by Langfuse. |

#### List Datasets

List Langfuse datasets available to the connected project.

**Inputs**

| Field            | Type    | Required | Description                                                                      |
| ---------------- | ------- | -------- | -------------------------------------------------------------------------------- |
| Maximum Datasets | integer | No       | The maximum number of datasets to return. Minimum: 1. Maximum: 100. Default: 50. |
| Page             | integer | No       | The Langfuse page number to retrieve. Minimum: 1. Default: 1.                    |

**Outputs**

| Field     | Type          | Description                                            |
| --------- | ------------- | ------------------------------------------------------ |
| Datasets  | object\_array | The datasets found in the connected project.           |
| Next Page | integer       | The next page number when more datasets are available. |

#### Create Dataset

Create a Langfuse dataset with optional validation schemas.

**Inputs**

| Field        | Type     | Required | Description                                          |
| ------------ | -------- | -------- | ---------------------------------------------------- |
| Dataset Name | string   | Yes      | A unique name for the dataset.                       |
| Description  | textarea | No       | What the dataset contains and how it should be used. |
| Options      | object   | No       | Optional metadata and JSON Schema validation.        |

**Outputs**

| Field   | Type   | Description                      |
| ------- | ------ | -------------------------------- |
| Dataset | object | The dataset created by Langfuse. |

#### List Dataset Items

List evaluation examples from one Langfuse dataset.

**Inputs**

| Field         | Type            | Required | Description                                                                          |
| ------------- | --------------- | -------- | ------------------------------------------------------------------------------------ |
| Dataset       | select (string) | Yes      | The dataset whose items should be listed. Options load from the selected connection. |
| Maximum Items | integer         | No       | The maximum number of dataset items to return. Default: 50.                          |
| Options       | object          | No       | Optional pagination, historical-version, and source filters.                         |

**Outputs**

| Field         | Type          | Description                                         |
| ------------- | ------------- | --------------------------------------------------- |
| Dataset Items | object\_array | The dataset items returned by Langfuse.             |
| Next Page     | integer       | The next page number when more items are available. |

#### List Prompts

List prompt names, versions, labels, and tags in Langfuse.

**Inputs**

| Field           | Type    | Required | Description                                                                     |
| --------------- | ------- | -------- | ------------------------------------------------------------------------------- |
| Maximum Prompts | integer | No       | The maximum number of prompts to return. Minimum: 1. Maximum: 100. Default: 50. |
| Name Contains   | string  | No       | Filter prompts by name.                                                         |
| Options         | object  | No       | Optional pagination, label, tag, and update-time filters.                       |

**Outputs**

| Field     | Type          | Description                                           |
| --------- | ------------- | ----------------------------------------------------- |
| Prompts   | object\_array | The prompt summaries returned by Langfuse.            |
| Next Page | integer       | The next page number when more prompts are available. |

#### Create Prompt Version

Create a new immutable text or chat prompt version in Langfuse.

**Inputs**

| Field          | Type            | Required | Description                                                                                          |
| -------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------- |
| Prompt Name    | select (string) | Yes      | The prompt whose first or next version should be created. Options load from the selected connection. |
| Prompt Type    | select (string) | Yes      | Whether this version is plain text or a chat prompt. Available values: Text, Chat. Default: text.    |
| Prompt Content | textarea        | Yes      | The text template or chat-message JSON for this version.                                             |
| Labels         | string          | No       | Comma-separated deployment labels for this version.                                                  |
| Options        | object          | No       | Optional tags, configuration, and commit message.                                                    |

**Outputs**

| Field          | Type   | Description                                  |
| -------------- | ------ | -------------------------------------------- |
| Prompt Version | object | The new prompt version returned by Langfuse. |

#### Set Prompt Version Labels

Replace the complete label list for one Langfuse prompt version.

**Inputs**

| Field            | Type            | Required | Description                                                                                           |
| ---------------- | --------------- | -------- | ----------------------------------------------------------------------------------------------------- |
| Prompt           | select (string) | Yes      | The Langfuse prompt whose version labels will be replaced. Options load from the selected connection. |
| Version          | integer         | Yes      | The positive prompt version whose labels will be replaced. Minimum: 1.                                |
| Labels           | string          | No       | Comma-separated labels that replace the version's entire existing label list.                         |
| Clear All Labels | boolean         | No       | Remove every label from this prompt version. Default: false.                                          |

**Outputs**

| Field          | Type   | Description                                                            |
| -------------- | ------ | ---------------------------------------------------------------------- |
| Prompt Version | object | The updated Langfuse prompt version, including its replacement labels. |

#### List Scores

List and filter evaluation scores from Langfuse.

**Inputs**

| Field          | Type    | Required | Description                                                                    |
| -------------- | ------- | -------- | ------------------------------------------------------------------------------ |
| Maximum Scores | integer | No       | The maximum number of scores to return. Minimum: 1. Maximum: 100. Default: 50. |
| Score ID       | string  | No       | Return one exact score by ID.                                                  |
| Options        | object  | No       | Optional pagination, score-property, subject, and time filters.                |

**Outputs**

| Field       | Type          | Description                                             |
| ----------- | ------------- | ------------------------------------------------------- |
| Scores      | object\_array | The typed scores returned by Langfuse.                  |
| Next Cursor | string        | The continuation cursor when more scores are available. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/langfuse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
