Skip to content

Commit 7f2bf09

Browse files
committed
[Feature] Tool services
ghstack-source-id: 8e958b8 Pull-Request: #3220
1 parent 137958a commit 7f2bf09

File tree

17 files changed

+4528
-260
lines changed

17 files changed

+4528
-260
lines changed

.github/unittest/llm/scripts_llm/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ dependencies:
2222
- transformers
2323
- datasets
2424
- vllm
25+
- mcp

.github/unittest/llm/scripts_llm/install.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,17 @@ python -m pip install -e . --no-build-isolation
6161

6262
# smoke test
6363
python -c "import torchrl"
64+
65+
# Install MCP dependencies for tool execution tests
66+
printf "* Installing MCP dependencies (uvx, Deno)\n"
67+
68+
# Install uvx (universal package runner)
69+
pip install uvx
70+
71+
# Install Deno (required by mcp-run-python)
72+
curl -fsSL https://deno.land/install.sh | sh
73+
export PATH="$HOME/.deno/bin:$PATH"
74+
75+
# Verify installations
76+
uvx --version || echo "Warning: uvx not installed"
77+
deno --version || echo "Warning: Deno not installed"

docs/source/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ API Reference
1010
llms
1111
modules
1212
objectives
13+
services
1314
trainers
1415
utils
1516
config

docs/source/reference/llms.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,9 @@ Tools are usually implemented as transforms, and appended to a base environment
930930
such as :class:`~torchrl.envs.llm.ChatEnv`.
931931

932932
An example of a tool transform is the :class:`~torchrl.envs.llm.transforms.PythonInterpreter` transform, which is used
933-
to execute Python code in the context of the LLM.
933+
to execute Python code in the context of the LLM. The PythonInterpreter can optionally use a shared
934+
:class:`~torchrl.envs.llm.transforms.PythonExecutorService` for efficient resource usage across multiple environments.
935+
See :ref:`ref_services` for more details on the service registry system.
934936

935937
>>> from torchrl.envs.llm.transforms import PythonInterpreter
936938
>>> from torchrl.envs.llm import ChatEnv
@@ -1141,6 +1143,7 @@ By following these design principles, reward transforms can be effectively integ
11411143
KLRewardTransform
11421144
MCPToolTransform
11431145
PolicyVersion
1146+
PythonExecutorService
11441147
PythonInterpreter
11451148
RayDataLoadingPrimer
11461149
RetrieveKL

0 commit comments

Comments
 (0)