[Feature] MCP and HTTP tools, agentic tutorial, see-also pointers#3737
Open
vmoens wants to merge 2 commits into
Open
[Feature] MCP and HTTP tools, agentic tutorial, see-also pointers#3737vmoens wants to merge 2 commits into
vmoens wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3737
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New FailuresAs of commit ff12538 with merge base d386287 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced May 10, 2026
vmoens
added a commit
that referenced
this pull request
May 11, 2026
Adds the remaining built-ins, a sphinx-gallery tutorial, and soft "see also" pointers in the legacy classes' docstrings. No DeprecationWarning is emitted -- legacy transforms keep working unchanged, and the as_tool() adapter from the previous commit gives users a soft migration path. New tools under torchrl.envs.llm.agentic.tools: - MCPToolset / MCPServerConfig: connects to an MCP server over stdio and materialises remote tools as N native Tool instances, each with the server's auto-discovered input_schema. Replaces the legacy MCPToolTransform's background-thread plumbing with native asyncio. Optional dependency on the 'mcp' package. - HttpTool: stdlib-only async HTTP via urllib.request offloaded to a worker thread. Optional allowed_hosts list plus a hard max_response_bytes cap. Pair with RateLimiter under ToolCompose for per-host throttling. torchrl.envs.llm.agentic top-level exports gain HttpTool, MCPServerConfig, MCPToolset. Documentation: - New sphinx-gallery tutorial tutorials/sphinx-tutorials/llm_agentic.py walking through a minimal agentic loop (Python + Stop), parser swapping (XML / JSON / OpenAI / Anthropic), parallel-dispatch motivation, the as_tool() migration recipe, and an MCP example. Smoke-tested end-to-end (prints '<tool_result call_id="c1">4</tool_result>'). - docs/source/reference/llms_envs.rst gains a "Built-in tools and adapters" autosummary block and a migration table mapping each legacy class to its agentic counterpart and adapter recipe. Soft .. seealso:: pointers added to the docstrings of: ExecuteToolsInOrder, PythonInterpreter, SimpleToolTransform, MCPToolTransform, BrowserTransform, XMLBlockParser, JSONCallParser. Each points readers at the modern equivalent or the as_tool() adapter without changing runtime behaviour. Tests extend test/llm/test_llm_transforms.py with TestMCPToolset (import-gated, server config) and TestHttpTool (host allowlist, protocol conformance). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> ghstack-source-id: 7432aa1 Pull-Request: #3737
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
Adds the remaining built-ins, a sphinx-gallery tutorial, and soft
"see also" pointers in the legacy classes' docstrings. No
DeprecationWarning is emitted -- legacy transforms keep working
unchanged, and the as_tool() adapter from the previous commit gives
users a soft migration path.
New tools under torchrl.envs.llm.agentic.tools:
and materialises remote tools as N native Tool instances, each with
the server's auto-discovered input_schema. Replaces the legacy
MCPToolTransform's background-thread plumbing with native asyncio.
Optional dependency on the 'mcp' package.
worker thread. Optional allowed_hosts list plus a hard
max_response_bytes cap. Pair with RateLimiter under ToolCompose for
per-host throttling.
torchrl.envs.llm.agentic top-level exports gain HttpTool,
MCPServerConfig, MCPToolset.
Documentation:
walking through a minimal agentic loop (Python + Stop), parser
swapping (XML / JSON / OpenAI / Anthropic), parallel-dispatch
motivation, the as_tool() migration recipe, and an MCP example.
Smoke-tested end-to-end (prints '<tool_result call_id="c1">4</tool_result>').
adapters" autosummary block and a migration table mapping each legacy
class to its agentic counterpart and adapter recipe.
Soft .. seealso:: pointers added to the docstrings of:
ExecuteToolsInOrder, PythonInterpreter, SimpleToolTransform,
MCPToolTransform, BrowserTransform, XMLBlockParser, JSONCallParser.
Each points readers at the modern equivalent or the as_tool() adapter
without changing runtime behaviour.
Tests extend test/llm/test_llm_transforms.py with TestMCPToolset
(import-gated, server config) and TestHttpTool (host allowlist,
protocol conformance).
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com