Tool Capability

April 10, 2026 ยท View on GitHub

Source: src/langgraph_kit/core/tools/capability.py

ToolRisk

class ToolRisk(str, Enum):
    READ_ONLY = "read_only"       # No side effects
    MUTATING = "mutating"         # Modifies state
    DESTRUCTIVE = "destructive"   # Hard to reverse

ToolCapability

class ToolCapability(BaseModel):
    id: str                              # Unique identifier
    name: str                            # Display name
    description: str                     # Tool description (shown to LLM)
    fn: Callable                         # The actual callable
    tags: list[str] = []                 # Arbitrary labels for filtering
    risk: ToolRisk = ToolRisk.READ_ONLY  # Risk classification
    prompt_guidance: str = ""            # Injected into system prompt
    profiles: list[str] = []            # Applicable profiles (e.g., "coding")
    worker_types: list[str] = []        # Applicable worker types
    max_output_tokens: int = 0          # Hint for output size
    offload_large_results: bool = False  # Store large outputs externally
    interrupt_before: bool = False       # Pause for approval before execution

Fields

FieldTypeDefaultDescription
idstr(required)Unique identifier for lookup and deduplication
namestr(required)Human-readable name
descriptionstr(required)Description shown to the LLM for tool selection
fnCallable(required)The async function to execute
tagslist[str][]Labels for filtering (e.g., ["search", "web"])
riskToolRiskREAD_ONLYRisk level for filtering and approval logic
prompt_guidancestr""Prompt fragment injected when this tool is active
profileslist[str][]Profiles this tool applies to (empty = all)
worker_typeslist[str][]Worker types this tool applies to (empty = all)
max_output_tokensint0Expected max output size (for context budgeting)
offload_large_resultsboolFalseIf true, large outputs are stored externally
interrupt_beforeboolFalseIf true, requires human approval before execution

Example

from langgraph_kit.core.tools.capability import ToolCapability, ToolRisk

cap = ToolCapability(
    id="web-search",
    name="Web Search",
    description="Search the web for current information",
    fn=web_search_fn,
    tags=["search", "web"],
    risk=ToolRisk.READ_ONLY,
    prompt_guidance="Use web search for current events or real-time data.",
    profiles=["research", "general"],
    worker_types=["researcher"],
)