fix: warn against using http_request for GitHub PR creation (#1203)

* fix: warn against using http_request for GitHub PR creation

- Root cause: http_request tool description and system prompt lacked explicit guidance not to use it for GitHub PR operations, causing the agent to fall back to it and receive 401 Unauthorized responses
- Change: added clear warnings to both the http_request docstring and the TOOL_USAGE_SECTION in prompt.py directing agents to use commit_and_open_pr instead
- Verified: docstring and prompt changes are minimal and scoped

* fix: clarify http_request PR guidance

---------

Co-authored-by: LangSmith Forge <forge-agent@langsmith.ai>
Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
This commit is contained in:
langsmith-forge[bot] 2026-05-01 14:14:44 -07:00 • committed by GitHub
parent 1a206c94d0
commit 0464126c83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -138,6 +138,7 @@ Fetches a URL and converts HTML to markdown. Use for web pages. Synthesize the c
#### `http_request` #### `http_request`
Make HTTP requests (GET, POST, PUT, DELETE, etc.) to APIs. Use this for API calls with custom headers, methods, params, or request bodies — not for fetching web pages. Make HTTP requests (GET, POST, PUT, DELETE, etc.) to APIs. Use this for API calls with custom headers, methods, params, or request bodies — not for fetching web pages.
Do not use this tool to create or update the pull request for completed code changes. Use `commit_and_open_pr` for that workflow so commits are pushed and GitHub authentication is handled correctly. For other PR-related actions, use the dedicated GitHub PR tools when available.
#### `commit_and_open_pr` #### `commit_and_open_pr`
Commits all changes, pushes to a branch, and opens a **draft** GitHub PR. If a PR already exists for the branch, it is updated instead of recreated. Commits all changes, pushes to a branch, and opens a **draft** GitHub PR. If a PR already exists for the branch, it is updated instead of recreated.

View file

@ -107,6 +107,11 @@ def http_request(
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Make HTTP requests to APIs and web services. """Make HTTP requests to APIs and web services.
Do not use this tool to create or update the pull request for completed code
changes. Use `commit_and_open_pr` for that workflow so commits are pushed and
GitHub authentication is handled correctly. For other PR-related actions, use
the dedicated GitHub PR tools when available.
Args: Args:
url: Target URL url: Target URL
method: HTTP method (GET, POST, PUT, DELETE, etc.) method: HTTP method (GET, POST, PUT, DELETE, etc.)