Catalog PyPI
Back to packageRELEASE DETAILS

0.2.0

PyPI

actiongate-langchain

Gate LangChain tool execution through ActionGate primitives before execution.

actiongateai-agentsexecution-controllangchaintool-use
Published16 Mar 2026
Direct dependencies6
Transitive dependenciesNot calculated

README

Version 0.2.0 documentation

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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 9

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
actiongate
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
actiongate>=0.2.2runtime
langchain-core
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
langchain-core>=0.2.0runtime
auditgate
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
auditgate>=0.2.0; extra == "all"runtime
budgetgate
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
budgetgate>=0.3.0; extra == "all"runtime
rulegate
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
rulegate>=0.2.2; extra == "all"runtime
auditgate
Environment
{
  "extras": "",
  "marker": "extra == \"audit\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
auditgate>=0.2.0; extra == "audit"runtime
budgetgate
Environment
{
  "extras": "",
  "marker": "extra == \"budget\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
budgetgate>=0.3.0; extra == "budget"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8.0; extra == "dev"runtime
rulegate
Environment
{
  "extras": "",
  "marker": "extra == \"rules\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
rulegate>=0.2.2; extra == "rules"runtime

Distribution files

2 collected
actiongate_langchain-0.2.0-py3-none-any.whl

bdist_wheel · 8.92 KB · Python py3

Source file
actiongate_langchain-0.2.0.tar.gz

sdist · 9.53 KB · Python source

Source file

Repository

PENDING
actiongate-oss/actiongate-langchain

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:65299667fa7f9025fdd1cc068cb4ceafd2b7dd4058dcb30bcf27345c90cbc43a

Other collected versions

View all collected versions →