Improve agent workloads with local tokenizer support - #25
Merged
Conversation
There was a problem hiding this comment.
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_loaderto load tokenizers from a HF model ID, a localtokenizer.json, or a directory containingtokenizer.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 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 on lines
+676
to
+678
| if config.ignore_eos { | ||
| map.insert("ignore_eos".to_string(), json!(true)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tokenizer.jsonfile, or a directory containingtokenizer.jsonuserfield and theX-SMG-Routing-KeyheaderWhy
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 -- --checkcargo test --manifest-path rust/Cargo.toml(22 passed)git diff --check