This repository contains TVCache and an end-to-end training example that demonstrates its use. TVCache speeds up RL training of tool-using agents by caching tool execution results in a Tool Call Graph (TCG). TCG is a prefix tree of tool call sequences that enables reuse across rollouts and epochs.
├── tvcache/ # TVCache server and client library
│ ├── server/ # HTTP server that maintains the TCG
│ └── client/ # Python client (tvclient) for integrating TVCache into training loops
├── train/ # Example: Video QA agent trained with Tinker API
└── video-agent-tools/ # Video sandbox server (tool execution backend for the example)
cd tvcache/server
uv sync
uv run tvcache_server.py # http://localhost:8000See the server README for API details and configuration.
The example uses a video analysis sandbox. See the video-agent-tools README for setup.
cd train
uv sync
uv pip install -e ../tvcache/client # install tvclientSet your Tinker API key in run.sh, then:
./run.sh train_with_tvcache.pySee the training README for dataset preparation and configuration. See the integration guide for how to integrate tvclient into your own training loop.
| Component | What it does | README |
|---|---|---|
| TVCache server | Maintains the TCG, handles prefix matching, environment locking, and pruning | tvcache/server |
| tvclient | Python library: ToolCall, ToolCallEnv, AsyncSemanticStatefulExecutor |
tvcache/client |
| train | Video QA RL training with Tinker API (three variants: no cache, stateless dict cache, TVCache) | train |
| video-agent-tools | Sandbox server wrapping VideoAgent (ECCV 2024) for video analysis tools | video-agent-tools/VideoAgent |
