# agentron
**Agentron (Ag)** — a unit of *agentic work volume*:
```text
Ag = hours × Mtokens // Mtokens = tokens / 1_000_000
```
It fuses the two things that actually cost during an agent run — wall-clock
**time** and **tokens** — into one comparable number (think kWh, not km/h).
## Install
```toml
[dependencies]
agentron = "0.1"
```
## Use
```rust
use agentron::{agentron, agentron_total, compute_agentron, format_ag, Time};
agentron(1_500_000.0, Time::Hours(2.0)); // 3.0 — a 2 h run over 1.5M tokens
agentron(316_887.0, Time::Seconds(960.0)); // 0.0845
compute_agentron(3_600_000.0, 1_000_000.0); // 1.0 (durationMs, tokens)
format_ag(0.0845); // "0.08 Ag"
// several agents at once: sum the inputs, THEN multiply
agentron_total(&[(1_000_000.0, 1.0), (1_000_000.0, 1.0)]); // 4.0, not 2.0
```
`compute_agentron(duration_ms, tokens)` mirrors the reference JS implementation
in [`gravitymir/agent_web`](https://github.com/gravitymir/agent_web).
## Why multiply for multi-agent?
Parallel agents share the same real-time window, so their combined *volume*
multiplies rather than adds: two agents, each 1 h over 1M tokens, give
`(1+1) × (1+1) = 4 Ag`, not `2 Ag`.
## License
MIT. Part of <https://github.com/gravitymir/agentron>.