§ Integration · LangChain

LangChain calendar tools that don't double-book.

agentdraft-langchain drops two calendar tools into any langchain-core-compatible agent. They check availability, commit bookings, and surface lost races as plain-language messages the LLM can react to — backed by AgentDraft's storage-level conflict engine so two agents on the same calendar resolve to a single deterministic winner.

Updated


§ 01Install
pip install agentdraft-langchain

Requires Python 3.9+ and langchain-core >= 0.3. Set AGENTDRAFT_API_KEY to an avs_live_… agent key from the dashboard.


§ 02A LangGraph agent that books calendars
from agentdraft_langchain import get_agentdraft_tools
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

tools = get_agentdraft_tools()                # reads AGENTDRAFT_API_KEY
agent = create_react_agent(ChatOpenAI(model="gpt-4o"), tools)

agent.invoke({"messages": [
    ("user", "Book me a 30-min call tomorrow at 2pm UTC."),
]})

Two tools land on the agent: agentdraft_get_availability and agentdraft_commit_booking_safe. Both are BaseTool subclasses, so LangGraph, CrewAI (via its native LangChain interop), and AutoGen (through LangChainToolAdapter) accept them without an adapter layer.


§ 03The tools at a glance
ToolTool namePurpose
AvailabilityToolagentdraft_get_availabilityList the slots open to this agent between two times.
ConflictAwareBookingToolagentdraft_commit_booking_safeCommit a booking. On a lost race, return a plain-language message instead of raising — the LLM picks another slot.
BookingToolagentdraft_commit_bookingCommit a booking. On a lost race, raise ToolException — for graphs that handle conflicts in code, not in the LLM.

§ 04Why a coordination layer matters in LangChain

Most LangChain calendar tools we've seen call the underlying calendar API directly — typically Google Calendar or Calendly. That works for one agent. With two agents on the same calendar, the calendar API has no notion of "the other agent that was about to write here," so both agents succeed in writing and the human gets overlapping events. The multi-agent calendar collision is the predictable consequence.

agentdraft-langchain sends every booking through AgentDraft's coordination layer first. The conflict engine resolves the race against every other agent on that user's calendar at the storage layer — a single TransactWriteItems with conditional writes per time bucket — and only the winner ever reaches the underlying calendar. Lost races surface as a typed 409 with the winner's identity, priority, and audit reference.


§ 05CrewAI, AutoGen, and direct LangChain

Because each tool is a langchain_core.tools.BaseTool:

  • LangChain & LangGraph — pass the tool list to any agent constructor that accepts tools (create_react_agent, AgentExecutor, etc.).
  • CrewAI — drop the same tool list into a Crew's tools= parameter. CrewAI consumes LangChain tools natively.
  • AutoGen — wrap each tool with LangChainToolAdapter from autogen-ext and register them with the AssistantAgent.
  • No framework — install agentdraft directly and call client.bookings.create(...).

§ 06

Frequently asked

Which agent frameworks does agentdraft-langchain work with?

Anything built on langchain-core ≥ 0.3 — that covers LangChain itself, LangGraph, CrewAI, and AutoGen. The tools expose plain LangChain tool interfaces, so the agent framework only needs to know how to call a LangChain tool.

What happens when two LangChain agents race for the same slot?

AgentDraft's conflict engine resolves the race at the storage layer via a single conditional write. Exactly one writer wins; the losing tool call returns a plain-language message the LLM can read (e.g. "that slot is taken by Agent X, priority 2 — pick another") instead of an exception.

Do I need a paid AgentDraft account to use the LangChain tools?

You need an AgentDraft account. Individual starts at $10/month for one user and up to three agents; Team is $25/month when multiple agents need shared priority resolution.


§ 07Further reading