Add sales tax calculation as a native LangChain tool. Your agents resolve tax obligations before invoicing — no guessing, no manual lookups, no compliance gaps.
INSTALL
Wrap the AgentTax SDK in a @tool-decorated function. LangChain handles the rest — the agent will call it automatically when it needs tax information.
from langchain.tools import tool
from agenttax import AgentTaxClient
client = AgentTaxClient(api_key="atx_live_...")
@tool
def calculate_sales_tax(
amount: float,
buyer_state: str,
transaction_type: str,
counterparty_id: str,
is_b2b: bool = False,
) -> dict:
"""Calculate US sales tax for an agent transaction.
Args:
amount: Transaction amount in USD
buyer_state: Two-letter state code (e.g. 'CA', 'TX')
transaction_type: Type of service ('saas', 'compute', 'consulting', etc.)
counterparty_id: Unique ID of the buyer agent
is_b2b: True if selling to another business
Returns:
dict with taxable, total_tax, combined_rate, confidence
"""
return client.calculate(
role="seller",
amount=amount,
buyer_state=buyer_state,
transaction_type=transaction_type,
counterparty_id=counterparty_id,
is_b2b=is_b2b,
)Pass it alongside your other tools. The agent decides when to call it based on context.
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_openai import ChatOpenAI
from langchain.tools import tool
# Add the tool to your agent
tools = [calculate_sales_tax]
llm = ChatOpenAI(model="gpt-4o")
agent = create_openai_tools_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
# Agent now resolves tax before invoicing
result = executor.invoke({
"input": "I'm billing agent-buyer-42 $1,500 for compute work in Texas. What's the tax?"
})
# Agent calls calculate_sales_tax(1500, "TX", "compute", "agent-buyer-42")
# → taxable: True, total_tax: 75.00, combined_rate: 5%, confidence: high{
"taxable": true,
"total_tax": 75.00,
"combined_rate": 0.05,
"state_tax": 75.00,
"local_tax": 0.00,
"buyer_state": "TX",
"transaction_type": "compute",
"work_type": "compute",
"classification_basis": "digital_service",
"confidence": { "score": 95, "level": "high" },
"advisories": ["TX §151.351: 80% of digital services taxable (20% statutory exemption)"],
"transaction_id": "txn_abc123"
}Free tier — 100 calls/month, no credit card. Upgrade when you need more.
© 2026 Agentic Tax Solutions LLC. Tax rates verified daily against Tax Foundation, Sales Tax Institute, state DOR websites, Anrok, TaxJar, TaxCloud, and Kintsugi. AgentTax provides tax calculations for informational purposes only. Consult a qualified tax professional for compliance decisions.