Skip to main content

LangChain tools for AgentDraft — let LangChain, LangGraph, CrewAI, and AutoGen agents book calendars through the coordination layer without colliding.

Project description

agentdraft-langchain — LangChain tools for AgentDraft

PyPI Python License: MIT

LangChain tools that let an agent book calendars through AgentDraft — the coordination layer for AI scheduling agents — so two agents racing for the same slot resolve to a single deterministic winner instead of double-booking your calendar.

Each tool is a langchain_core.tools.BaseTool: LangChain and LangGraph consume it directly, CrewAI accepts LangChain tools natively, and AutoGen uses it through its LangChainToolAdapter.

Install

pip install agentdraft-langchain

Requires Python 3.9+, langchain-core>=0.3, and a valid avs_live_… agent key from the AgentDraft dashboard.

Quickstart

from agentdraft_langchain import get_agentdraft_tools

# Reads AGENTDRAFT_API_KEY (and optional AGENTDRAFT_BASE_URL) from the env.
tools = get_agentdraft_tools()

# Hand `tools` to any langchain-core-compatible agent. With LangGraph:
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

agent = create_react_agent(ChatOpenAI(model="gpt-4o"), tools)
agent.invoke({"messages": [("user", "Book me a 30-min call tomorrow at 2pm UTC.")]})

get_agentdraft_tools() returns two tools: agentdraft_get_availability and a booking tool. By default the booking tool is conflict-aware — see below.

The tools

Tool name Purpose
AvailabilityTool agentdraft_get_availability List the slots open to this agent between two times
ConflictAwareBookingTool agentdraft_commit_booking_safe Commit a booking; on a lost race, return guidance instead of raising
BookingTool agentdraft_commit_booking Commit a booking; raise ToolException if outranked

All times are ISO 8601 strings (2026-06-01T14:00:00Z). The booking tools accept an optional idempotency_key for safe retries.

You can also construct tools directly against an explicit client:

from agentdraft import Client
from agentdraft_langchain import AvailabilityTool, ConflictAwareBookingTool

client = Client(api_key="avs_live_...")
tools = [AvailabilityTool(client=client), ConflictAwareBookingTool(client=client)]

How a lost race surfaces

When two agents race for the same slot, exactly one wins. The booking tools differ only in how the losing agent finds out:

  • ConflictAwareBookingTool (default in get_agentdraft_tools()) returns a plain-language message so the LLM can react:

    OUTRANKED — your booking was not committed. A higher-priority agent
    (agent_id=agt_sales, priority=1) already holds this slot
    (winning_booking_id=bkg_…). Your priority is 3. Do not retry the same
    slot — call agentdraft_get_availability and propose a different time
    to your user.
    

    An autonomous agent reads this and proposes an alternate slot.

  • BookingTool raises langchain_core.tools.ToolException with the same message. Use it when you want the surrounding framework to handle the failure explicitly.

A lost race is a normal, expected outcome of a coordination layer — not a bug. Prefer the conflict-aware tool for agents that run unattended.

Use with CrewAI / AutoGen

CrewAI accepts LangChain tools directly — pass the list get_agentdraft_tools() returns to a CrewAI Agent(tools=...). AutoGen wraps each tool with LangChainToolAdapter from autogen_ext.tools.langchain. Either way the conflict semantics are identical to the LangChain path.

How this differs from the other AgentDraft packages

agentdraft (SDK) agentdraft-langchain agentdraft-mcp
Caller App code you wrote A LangChain-family agent An MCP host (Claude Desktop, etc.)
Surface Client methods BaseTool objects MCP tools over stdio
Conflict Conflict exception Message or ToolException Structured JSON result

All three wrap the same REST API with the same auth and semantics.

Links

Security

Found a vulnerability? See https://agentdraft.io/securitydo not open a public issue for a security report.

Contributing

See CONTRIBUTING.md. This package lives inside the GipsyChef/agentdraft monorepo under sdks/langchain/.

License

MIT — see https://agentdraft.io/legal/license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentdraft_langchain-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentdraft_langchain-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file agentdraft_langchain-0.1.0.tar.gz.

File metadata

  • Download URL: agentdraft_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for agentdraft_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d95417d294d4f505c4cf1f5a307587d4b3b17d485158b5d2e5e24c57f417fc74
MD5 b10e97737823ec08090fa03d5a4da073
BLAKE2b-256 a17a4ddd3dd4b1959f5ace0e7cb94c4517b62f58deba36d51845966816ddf341

See more details on using hashes here.

File details

Details for the file agentdraft_langchain-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentdraft_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f8922c647e56f92ceea1c41b6e0e8f8989d18395e04543e9ff3854e9aa7f0a4
MD5 38e425a2469552cba625ef7e48dd887a
BLAKE2b-256 e4678eca8cae7d66615f6acf2d0425787ce342ae0d05e898766647085e514ddf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page