Tool Versioning
Version management for tools enabling backward compatibility and gradual rollouts.
Overview
Tool versioning allows maintaining multiple versions of tools simultaneously, enabling smooth upgrades and A/B testing.
Versioning Strategy
from recoagent.tools import ToolRegistry
registry = ToolRegistry()
# Register version 1.0
registry.register_tool(
name="search_tool",
version="1.0",
implementation=search_v1
)
# Register version 2.0
registry.register_tool(
name="search_tool",
version="2.0",
implementation=search_v2
)
# Use specific version
tool = registry.get_tool("search_tool", version="1.0")
# Use latest version
tool = registry.get_tool("search_tool") # Uses 2.0
Version Selection
- Explicit Version: Specify exact version
- Latest Version: Use latest by default
- Semantic Versioning: Support semver ranges
Migration
# Gradual rollout
if user_in_beta_group:
tool = registry.get_tool("search_tool", version="2.0")
else:
tool = registry.get_tool("search_tool", version="1.0")
Best Practices
- Semantic Versioning: Use semver for clarity
- Backward Compatibility: Maintain old versions during transition
- Deprecation Warnings: Warn users of deprecated versions
- Gradual Rollout: Test new versions with subset of users