# Id-agent: Token-Efficient UUID Alternative for AI Agents

> Published 2026-05-19 · https://www.promptzone.com/harper_korhonen/id-agent-token-efficient-uuid-alternative-for-ai-agents-3p16

**Id-agent** surfaced on Hacker News with a Show HN post that drew 17 points and 26 comments. The GitHub repository at [vostride/id-agent](https://github.com/vostride/id-agent) presents a drop-in identifier format that cuts token usage in LLM prompts compared with standard UUID strings.

> **Tool:** Id-agent | **Format:** 12-16 char base62 strings | **Token savings:** 40-55% vs UUIDv4 | **License:** MIT

## What Id-agent Is and How It Works

Id-agent generates collision-resistant identifiers using a custom base62 alphabet and optional prefix system. Agents produce IDs that remain unique across distributed sessions while staying shorter than the 36-character UUID format.

The library exposes a simple generate function that accepts an optional namespace prefix. This keeps identifiers readable in logs without adding extra tokens during model inference.


![Id-agent: Token-Efficient UUID Alternative for AI Agents](https://www.joshwcomeau.com/_next/image/?url=%2Fimages%2Fterminal-for-js-devs%2Ft-rm-r.png&w=3840&q=75)

## Token Efficiency Numbers

Tests shared in the repository show consistent reductions when IDs appear inside prompts or function calls. A typical agent conversation containing 50 identifiers drops from roughly 1,800 tokens with UUIDs to 950 tokens with Id-agent strings.

| Identifier | Avg chars | Tokens per 100 IDs | Collision rate (1M IDs) |
|------------|-----------|--------------------|-------------------------|
| UUIDv4     | 36        | 1,800              | < 10^-15                |
| NanoID     | 21        | 1,050              | < 10^-12                |
| Id-agent   | 14        | 700                | < 10^-12                |

Early HN commenters noted the savings become material once agents exchange structured data containing multiple IDs per turn.

## How to Try It

Install the package and generate the first identifier in under one minute.

```bash
pip install id-agent
python -c "import idagent; print(idagent.new('agent'))"
```

The same command works inside agent runtimes. The repository includes FastAPI and LangChain example snippets that swap UUID calls for Id-agent without changing surrounding logic.

## Pros and Cons

- Reduces prompt token counts by 40-55% in multi-ID workflows
- Maintains 128-bit entropy with shorter output
- MIT license allows commercial use without restrictions
- Requires one extra dependency in minimal environments
- Lacks built-in time ordering compared with ULID

## Alternatives and Comparisons

Teams already use NanoID for shorter IDs and ULID when chronological sorting matters. Id-agent sits between them by prioritizing token count over sortability.

| Feature          | Id-agent | NanoID | ULID   |
|------------------|----------|--------|--------|
| Token length     | 14       | 21     | 26     |
| Time sortable    | No       | No     | Yes    |
| Prefix support   | Yes      | Limited| No     |
| LLM prompt fit   | Best     | Good   | Fair   |

## Who Should Use This

Developers building multi-agent systems that pass many identifiers inside prompts benefit most. Skip Id-agent if your pipeline already relies on time-ordered IDs for debugging or database indexing.

## Bottom Line / Verdict

Id-agent delivers measurable token reduction for agent workloads that exchange large numbers of identifiers, provided teams accept the loss of built-in timestamp ordering.

The approach shows how small format changes compound across thousands of daily agent interactions.