Skip to content

Improve agent workloads with local tokenizer support - #25

Merged
jamesdborin merged 2 commits into
mainfrom
agent/local-tokenizer-support
Aug 18, 2026
Merged

Improve agent workloads with local tokenizer support#25
jamesdborin merged 2 commits into
mainfrom
agent/local-tokenizer-support

Conversation

@jamesdborin

Copy link
Copy Markdown
Contributor

Summary

  • improve agent workload simulation and reporting
  • allow request generation and agent benchmarks to load a tokenizer from a Hugging Face model ID, a local tokenizer.json file, or a directory containing tokenizer.json
  • send each agent's persistent user tag in both the OpenAI user field and the X-SMG-Routing-Key header
  • document the tokenizer and routing behavior

Why

BatchBench previously always resolved tokenizers through Hugging Face, preventing offline or locally provisioned tokenizer use. Agent routing also needed the same stable identifier in the request header and body for sticky routing.

Validation

  • cargo fmt --manifest-path rust/Cargo.toml -- --check
  • cargo test --manifest-path rust/Cargo.toml (22 passed)
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 18, 2026 16:59
@jamesdborin
jamesdborin merged commit 6061f02 into main Aug 18, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends BatchBench’s tokenizer handling to support offline/local tokenizers and enhances the agent workload loop with richer reporting plus stable per-agent routing identifiers propagated in both request headers and bodies.

Changes:

  • Add tokenizer_loader to load tokenizers from a HF model ID, a local tokenizer.json, or a directory containing tokenizer.json, and wire it into request generation and agent planning.
  • Add per-agent user tagging (OpenAI user + X-SMG-Routing-Key) and new agent end-to-end latency percentiles to agent benchmarking and CSV output.
  • Update agent loop behavior/documentation around tool-call envelopes and reporting semantics.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rust/src/tokenizer_loader.rs New tokenizer source resolution + loader and unit tests.
rust/src/lib.rs Exposes new tokenizer loader module to the crate.
rust/src/generator.rs Switches request generation to use the shared tokenizer loader.
rust/src/agent.rs Uses tokenizer loader; adds per-agent user tagging + routing header; adds end-to-end latency distribution; adjusts tool-call normalization behavior.
rust/src/agent_cli.rs Adds CLI toggles for ignore_eos and disabling user tagging; prints + records new metrics.
rust/Cargo.toml Adds uuid dependency for per-agent UUID tagging.
rust/Cargo.lock Locks new dependency graph for uuid and transitive crates.
README.md Documents tokenizer source options, routing behavior, and new latency reporting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/src/agent.rs
Comment on lines 667 to 670
let mut body = json!({
"model": config.model,
"messages": messages,
"tools": [{
"type": "function",
"function": {
"name": "environment",
"description": "Interact with the benchmark's synthetic environment.",
"parameters": {
"type": "object",
"properties": {
"request": {
"type": "string",
"description": "The environment operation to perform."
}
},
"required": ["request"]
}
}
}],
"tool_choice": {
"type": "function",
"function": {"name": "environment"}
},
"parallel_tool_calls": false
"messages": messages
});
Comment thread rust/src/agent.rs
Comment on lines +676 to +678
if config.ignore_eos {
map.insert("ignore_eos".to_string(), json!(true));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants