Commit Graph

1 Commits

Author SHA1 Message Date
Shanghua dc8e9b4237 feat: Add HTTP API server with auto-discovery and minimal client
Implement a production-ready HTTP API server that exposes all ToolUniverse
class methods remotely via REST endpoints. The server uses Python introspection
to automatically discover methods, requiring zero manual updates when the
ToolUniverse class changes.

Key Features:
- Auto-discovery: Server introspects ToolUniverse for all 49+ methods
- Minimal client: Only requires requests + pydantic (via pip install tooluniverse[client])
- Production ready: 8 workers by default, multi-worker support via uvicorn
- Stateful: Maintains ToolUniverse instance across requests
- Dynamic proxying: Client uses __getattr__ to proxy any method call to server
- Well tested: Comprehensive test suite with 182 lines of test code
- Well documented: RST documentation integrated into Sphinx docs

Server Components:
- src/tooluniverse/http_api_server.py: FastAPI server with endpoints
- src/tooluniverse/http_api_server_cli.py: CLI entry point
- Command: tooluniverse-http-api --host 0.0.0.0 --port 8080

Client Components:
- src/tooluniverse/http_client.py: Auto-proxying client
- Install: pip install tooluniverse[client]
- Import: from tooluniverse import ToolUniverseClient

Documentation:
- docs/guide/http_api.rst: Complete RST documentation
- examples/http_api_usage_example.py: 7 usage examples
- tests/test_http_api_server.py: Unit tests

Changes:
- Added [client] optional dependency to pyproject.toml
- Exported ToolUniverseClient in __init__.py
- Added HTTP API section to README.md
- Integrated http_api.rst into documentation tree
2026-01-27 17:13:49 -05:00