Skip to content

chore(repl): improve system prompt#2549

Merged
Eugene Yurtsev (eyurtsev) merged 1 commit into
mainfrom
eugene/update_tool_usage_relational_to_async
Apr 8, 2026
Merged

chore(repl): improve system prompt#2549
Eugene Yurtsev (eyurtsev) merged 1 commit into
mainfrom
eugene/update_tool_usage_relational_to_async

Conversation

@eyurtsev

@eyurtsev Eugene Yurtsev (eyurtsev) commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

improve prompt, handle some edge cases; this seems to max out our simple tool usage eval

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file infra Repo meta changes internal User is a member of the `langchain-ai` GitHub organization repl size: M 200-499 LOC labels Apr 8, 2026
@eyurtsev
Eugene Yurtsev (eyurtsev) marked this pull request as ready for review April 8, 2026 02:11
Copilot AI review requested due to automatic review settings April 8, 2026 02:11
@eyurtsev
Eugene Yurtsev (eyurtsev) merged commit 656401d into main Apr 8, 2026
44 checks passed
@eyurtsev
Eugene Yurtsev (eyurtsev) deleted the eugene/update_tool_usage_relational_to_async branch April 8, 2026 02:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the REPL system prompt’s “foreign function docs” formatting (moving to TypeScript-style signatures + JSDoc blocks) and extends the REPL parser/tests to handle some multiline argument formatting cases.

Changes:

  • Render foreign function documentation as ```ts blocks with JSDoc + TypeScript-like signatures and TypedDict type definitions.
  • Allow multiline formatting inside call argument lists (including parallel(...)) and add unit tests for it.
  • Update dependency lock/config and refresh prompt snapshot expectations.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/repl/langchain_repl/_foreign_function_docs.py Reworks foreign function docs rendering to JSDoc + TS-style signatures and type blocks.
libs/repl/langchain_repl/interpreter.py Allows newlines inside function call argument lists.
libs/repl/tests/unit_tests/test_foreign_function_docs.py Updates expected foreign function docs output to TS/JSDoc format.
libs/repl/tests/unit_tests/test_system_prompt.py Updates prompt assertions to match TS/JSDoc docs.
libs/repl/tests/unit_tests/test_interpreter.py Adds coverage for multiline arguments in parallel(...) and regular calls.
libs/repl/tests/unit_tests/test_end_to_end.py Adjusts fake model message iterator (adds an extra “done”).
libs/repl/tests/unit_tests/smoke_tests/snapshots/langchain_repl_system_prompt_mixed_foreign_functions.md Updates snapshot to the new TS/JSDoc foreign function docs section.
libs/repl/pyproject.toml Adjusts uv source configuration for local deepagents usage (editable).
libs/repl/uv.lock Updates lockfile entries and dependency versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 357 to 363
def _parse_arguments(self) -> list[Expression]:
args: list[Expression] = []
self._skip_newlines()
if self._match(")"):
return args
while True:
args.append(self._parse_expression())

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_parse_arguments() now skips NEWLINE tokens, but other expression contexts (notably _parse_list() / _parse_dict()) still don’t. As a result, multiline literals like [ 1, 2, ] will still fail with an unexpected NEWLINE token, which is surprising once multiline call arguments are supported. Consider applying the same _skip_newlines() handling in list/dict parsing (and possibly after opening delimiters / after commas) for consistent multiline formatting support.

Copilot uses AI. Check for mistakes.
Comment on lines +261 to +271
def _render_jsdoc(doc: str) -> str:
"""Convert a Python docstring into a compact JSDoc block."""
lines = inspect.cleandoc(doc).splitlines()
summary: list[str] = []
params: list[tuple[str, str]] = []
in_args = False
for line in lines:
stripped = line.strip()
if stripped and stripped != "Args:":
return stripped
return None
if stripped == "Args:":
in_args = True
continue

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_render_jsdoc() only treats Args: as a structured section; docstring section headers like Returns:, Raises:, Examples: will currently be appended to the rendered summary text. Consider explicitly skipping (or separately parsing) common section headers so the JSDoc block doesn’t include these raw markers and stays focused on summary + @param entries.

Copilot uses AI. Check for mistakes.
Comment on lines 148 to 152
],
),
AIMessage(content="done"),
AIMessage(content="done"),
]

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test now supplies two identical AIMessage(content="done") responses. Duplicating the same message makes the test less precise and can mask unexpected extra model invocations. Prefer asserting the expected number of model calls (via model.call_history) and/or making each fake response distinct so it’s clear which call consumed which message.

Copilot uses AI. Check for mistakes.
james8814 pushed a commit to james8814/deepagents that referenced this pull request May 1, 2026
improve prompt, handle some edge cases; this seems to max out our simple
tool usage eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file infra Repo meta changes internal User is a member of the `langchain-ai` GitHub organization size: M 200-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants