# classify_usage_kind

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/_session_stats/classify_usage_kind)

Classify a streamed model request for cost and usage breakdowns.

## Signature

```python
classify_usage_kind(
    *,
    is_main_agent: bool,
    metadata: Mapping[str, Any] | None = None,
) -> UsageKind
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `is_main_agent` | `bool` | Yes | Whether the stream namespace is the top-level agent. |
| `metadata` | `Mapping[str, Any] \| None` | No | LangChain callback/stream metadata for the chunk. (default: `None`) |

## Returns

`UsageKind`

The usage kind used in `/cost` and session stats.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e4c1ffe9ee63d7854147de490ca27495ef157a7b/libs/code/deepagents_code/_session_stats.py#L62)