Skip to content

fix: correctly bind async local plugins as coroutines - #143

Open
akshatmalik-bruh wants to merge 1 commit into
extra-org:mainfrom
akshatmalik-bruh:fix/async-local-plugins
Open

akshatmalik-bruh wants to merge 1 commit into
extra-org:mainfrom
akshatmalik-bruh:fix/async-local-plugins

Conversation

@akshatmalik-bruh

Copy link
Copy Markdown

Description

Problem

Currently, a local plugin implemented as async def is accepted during the engine build but never actually executes. The engine records the tool call as succeeded and hands the LLM a stringified coroutine object instead of the actual resolved value. This causes a P2 silent no-op.
fixes #141

The root cause was that GraphBuilder._build_agent_tools was passing all functions through StructuredTool.from_function(function). This registers async functions in the synchronous func slot, which LangChain's synchronous execution path returns instead of awaiting.

Solution

Updated GraphBuilder._build_agent_tools to properly detect async functions using inspect.iscoroutinefunction(function).

  • If it is a coroutine, it registers it using coroutine=function.
  • If it is synchronous, it continues to use func=function.

Testing and Verification

  • Added an executable regression test (tests/test_review_regression.py) that mocks a model and verifies that the async def body physically executes and writes to disk.
  • Existing synchronous local tools continue to work perfectly.
  • Ran make check and verified that formatting, linting, type-checking, and all tests pass locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][P2] async Python plugin tools are never awaited but are recorded as succeeded

1 participant