# count_unemitted_tool_calls

> **Function** in `deepagents_code`

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

Classify buffered tool calls that never emitted a `tool.use`.

Both surfaces log the same end-of-stream diagnostic for tool calls still in
their buffer map when the stream ends: those whose args never parsed, and
those whose args parsed but whose `tool_id` stayed `None` (so `tool.use` was
gated out). Sharing the classification here keeps the two diagnostics from
drifting; each surface still emits its own log lines. `parse_args` is safe to
re-run (idempotent bar its one-shot `warned` latch).

## Signature

```python
count_unemitted_tool_calls(
    buffers: Iterable[ToolCallBuffer],
) -> UnemittedToolCalls
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `buffers` | `Iterable[ToolCallBuffer]` | Yes | The in-progress tool-call buffers remaining at stream end. |

## Returns

`UnemittedToolCalls`

The `unparsed` and `idless_parsed` counts (see `UnemittedToolCalls`).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2f56309d821db4a0d06ee03959cf842c91b7f228/libs/code/deepagents_code/_tool_stream.py#L591)