Skip to content

Making search tools concurrent#1141

Merged
sidnarayanan merged 10 commits intomainfrom
partial-tool-concurrency
Oct 16, 2025
Merged

Making search tools concurrent#1141
sidnarayanan merged 10 commits intomainfrom
partial-tool-concurrency

Conversation

@sidnarayanan
Copy link
Copy Markdown
Collaborator

It is safe for search tools to run concurrently with each other, so this PR enables that.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 16, 2025
@dosubot dosubot bot added the enhancement New feature or request label Oct 16, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables concurrent execution of search tools by introducing a CONCURRENCY_SAFE class variable to NamedTool and marking PaperSearch and ClinicalTrialsSearch as safe for concurrent execution. The change allows the agent to run multiple search operations in parallel, improving performance.

Key Changes:

  • Added CONCURRENCY_SAFE class variable to NamedTool base class (defaults to False)
  • Marked PaperSearch and ClinicalTrialsSearch as concurrency-safe
  • Updated settings_to_tools to pass concurrency_safe flag when creating tools
  • Changed Environment.step to enable concurrent tool execution

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/paperqa/agents/tools.py Added CONCURRENCY_SAFE class variable and marked search tools as safe for concurrent execution; reformatted docstring formatting
src/paperqa/agents/env.py Updated tool creation to pass concurrency_safe flag and enabled concurrent execution in step method
tests/test_agents.py Updated test cases to include concurrency_safe parameter when creating tools; minor formatting cleanup
pyproject.toml Updated fhaviary dependency version to support partial tool concurrency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/paperqa/agents/env.py Outdated
@dosubot
Copy link
Copy Markdown

dosubot bot commented Oct 16, 2025

Documentation Updates

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment @cursor review or bugbot run to trigger another review on this PR

Comment thread src/paperqa/agents/env.py Outdated
@sidnarayanan sidnarayanan force-pushed the partial-tool-concurrency branch from b6e9bf4 to fbdc6e1 Compare October 16, 2025 17:26
Comment thread src/paperqa/agents/env.py Outdated
Comment thread tests/test_agents.py
Copy link
Copy Markdown
Collaborator

@jamesbraza jamesbraza left a comment

Choose a reason for hiding this comment

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

Nice work, LGTM!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 16, 2025
@sidnarayanan sidnarayanan merged commit acadf8b into main Oct 16, 2025
18 of 21 checks passed
@sidnarayanan sidnarayanan deleted the partial-tool-concurrency branch October 16, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants