Skip to content

[tau-bench] Make example runnable offline: stub user provider + robust tool parsing (parse_tools signature compatibility) #1157

@Fengzdadi

Description

@Fengzdadi

What happened

I’m running examples/tau-bench/generate_with_tau.py to validate the episode logging pipeline on a local machine (no GPU / no triton).
The run previously aborted due to:

  • user simulation calling external LLM (litellm/gemini) → 429 / API key issues
  • tool parser API mismatch (parse_tools() signature differences across versions)
  • a small bug in response dict access (output.get[...] vs output.get(...))

Expected

  • Be able to run 1 task end-to-end without external API keys (at least for validating logging + control flow).
  • Robust tool parsing fallback if tool parser is unavailable or signature differs.

Proposed changes

  1. Offline user sim
  • Allow user_model_provider="stub" (or provider="stub") so env step doesn’t call external LLM
  • Returns a canned user message like "(stub user) OK."
  • Cost = 0
  1. Tool parsing compatibility
    Add a wrapper in openai_tool_adapter.py that:
  • detects parse_tools signature (2-arg vs 3-arg)
  • supports different return schemas (e.g. missing normal_text)
  • falls back to “no tool calls” when parser unavailable
  1. Bugfix
    Use:
raw_response = output.get("text", "")

(currently it is output.get["text"])

Repro

  • Start local sglang http endpoint (or stub server) on 127.0.0.1:30000
  • Environment: macOS, CPU-only, no triton installed
  • Sanity check:
curl -s -X POST http://127.0.0.1:30000/generate \
  -H "Content-Type: application/json" \
  -d '{"text":"Say ONLY: OK123","sampling_params":{"temperature":0,"max_new_tokens":8}}'
  • Run the tau-bench example with user_model_provider="stub"

Result after patch

  • episode.jsonl is generated and env_step proceeds with observation (stub user) OK.
  • No external API calls are needed (no Gemini/OpenAI keys), so no 429.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions