[BOUNTY #2] LangChain Tool Guard β APort verification for LangChain tools#94
Open
JustABiologist wants to merge 2 commits into
Open
[BOUNTY #2] LangChain Tool Guard β APort verification for LangChain tools#94JustABiologist wants to merge 2 commits into
JustABiologist wants to merge 2 commits into
Conversation
Adds APortToolGuard, a wrapper for any LangChain BaseTool that gates every invocation behind an APort policy verification call. Changes: - `examples/agent-frameworks/langchain/tool_guard.py` - APortToolGuard class wrapping BaseTool with pre-execution verify - guard_tool() convenience function - MockAPortClient for development (replaceable with real SDK) - Agent ID resolution: config metadata > instance attribute > env var - fail_open/fail_closed modes for API error handling - Supports @tool, StructuredTool, and classic Tool types - `examples/agent-frameworks/langchain/example.py` - Working demo agent mixing guarded and unguarded tools - Per-call agent_id override via RunnableConfig - `examples/agent-frameworks/langchain/test_tool_guard.py` - 24 pytest cases: construction, verification pass/block, agent ID resolution, mock client, error types, metadata delegation, and integration with an agent using multiple guarded tools - `examples/agent-frameworks/langchain/README.md` - Install, quick start, tool type support, policies, fail-open mode Closes aporthq#2
Author
|
Thanks for reviewing. This PR is my submission for bounty #2 ($50 USD). If accepted/merged and the bounty is still payable, payout can be sent via PayPal to stab.me.papi@gmail.com. Happy to use another maintainer-preferred payout method if needed. |
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.
π° Claims bounty #2 β $50 USD
What
APortToolGuardβ a wrapper for any LangChainBaseToolthat gates everytool invocation behind an APort policy verification check. Before the
tool's logic executes, the agent's passport is verified against the
specified policy.
Features
@tooldecorator,StructuredTool, classicToolaporthq-sdk-pythonwhen available)Acceptance Criteria
/examples/agent-frameworks/langchainwith README and example agent using protected toolsFiles
Test Evidence
Coverage:
Example Output
Quick Start