---
title: score()
description: Langfuse-shaped measurements on a trace.
---

# score()

Attach a measurement to the active trace. `score()` is Langfuse-shaped (`name`, `value`, `data_type`, `source`, `comment`) — one type for code evals, API, and later annotations. It never raises: if `AGENKO_API_KEY` is unset it is a no-op.

## Record a score

```python
import agenko

agenko.init()

agenko.score("satisfaction", 0.9, source="api", comment="user rated 9/10")
```

```typescript
import agenko from "@agenko/sdk";

agenko.init();

await agenko.score("satisfaction", 0.9, { source: "api", comment: "user rated 9/10" });
```

## Arguments

| Argument | Default | Meaning |
|---|---|---|
| `name` | — | Score name |
| `value` | — | `float` / `int` / `str` / `bool` |
| `dataType` / `data_type` | `"numeric"` | `numeric` \| `categorical` \| `boolean` \| `text` |
| `source` | `"eval"` | `eval` \| `api` \| `annotation` |
| `comment` | — | Optional note |
| `traceId` / `trace_id` | active span | Explicit trace binding |
| `spanId` / `span_id` | active span | Explicit span binding |

## How it works

1. Reads the current span's `trace_id` / `span_id` if not given explicitly.
2. POSTs `/api/v1/scores/` with `X-API-Key`.
3. The console shows it as a score row on the trace.

Scores feed the `checks[]` rows on a receipt — they share the same `Score` schema (`name`, `value`, `data_type`, `source`, `comment`, `passed`).

## Boolean alias

For `boolean` scores, `passed` is `true` when the value is `1`.

## Next

- [Receipts](/receipts) — how checks are derived
- [Python SDK](/python) · [TypeScript SDK](/typescript)
- [What we reuse](/reuse) — Langfuse Score schema

## Agent instructions

This page: https://docs.agenko.app/scores.md

Fetch `/llms.txt` for the full index. Search: `GET /api/search-docs?query=...`
