actiongate-langchain
Gate LangChain tool execution through ActionGate primitives.
pip install actiongate-langchain
Quick start
from actiongate import Engine, Gate, Policy
from actiongate_langchain import gated_tool
ag = Engine()
@gated_tool(
actiongate=ag,
gate=Gate("tools", "search", "agent:1"),
policy=Policy(max_calls=10, window=60),
)
def search_web(query: str) -> str:
"""Search the web for a query."""
return api.search(query)
# Use with any LangChain agent
agent = create_react_agent(llm, [search_web], prompt)
The tool checks all gates before execution. If any gate blocks, it raises ToolException with the block reason — LangChain agents handle this automatically.
Add more gates
pip install actiongate-langchain[all]
from actiongate import Engine as AG, Gate, Policy
from budgetgate import Engine as BG, Ledger, Budget
from rulegate import Engine as RG, Rule, Ruleset, Context
from actiongate_langchain import gated_tool
from decimal import Decimal
def no_pii(ctx: Context) -> bool:
return "ssn" not in str(ctx.kwargs).lower()
ag, bg, rg = AG(), BG(), RG()
@gated_tool(
actiongate=ag,
gate=Gate("tools", "search", "agent:1"),
policy=Policy(max_calls=10, window=60),
budgetgate=bg,
ledger=Ledger("openai", "search", "agent:1"),
budget=Budget(max_spend=Decimal("5.00"), window=3600),
cost=Decimal("0.01"),
rulegate=rg,
rule=Rule("tools", "search"),
ruleset=Ruleset(predicates=(no_pii,)),
)
def search_web(query: str) -> str:
"""Search the web for a query."""
return api.search(query)
Gates evaluate in order: ActionGate → BudgetGate → RuleGate → execute → AuditGate.
GatedTool class
For more control, use GatedTool.from_function() directly:
from actiongate_langchain import GatedTool
tool = GatedTool.from_function(
func=search_fn,
name="search_web",
description="Search the web",
actiongate=ag,
gate=Gate("tools", "search", "agent:1"),
policy=Policy(max_calls=10, window=60),
)
License
Apache-2.0. ActionGate and BudgetGate are Apache-2.0. RuleGate and AuditGate are BSL-1.1.
Metadata
Release files for actiongate-langchain 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| actiongate_langchain-0.2.0.tar.gz | 9.8 kB | Without provenance | Details for actiongate_langchain-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| actiongate_langchain-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for actiongate_langchain-0.2.0-py3-none-any.whl |
Total release size: 18.9 kB
Release files / actiongate_langchain-0.2.0.tar.gz
| Download URL | actiongate_langchain-0.2.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa9063a8d741838661d70c1ce53a4a27342be177551ad16e34c47ee35aec1877
|
|
BLAKE2b-256 checksum How to use checksums |
31d9b236219c73f60dd4dd9ed868e1a4bbb80d6977661e56f08b32ab8f04488e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / actiongate_langchain-0.2.0-py3-none-any.whl
| Download URL | actiongate_langchain-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebd1573541b90285aadd81441e600bb12060dd100856e8136823298bccf5b52f
|
|
BLAKE2b-256 checksum How to use checksums |
41f8fd26ea6a541881c90f918a16ca8fec5ee2b98d553447a189697057f691a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for actiongate-langchain 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.