Overview

Welcome to the comprehensive reference documentation for the Kapso Builder SDK. This section provides detailed information about every class, method, and concept in the SDK.

Quick navigation

Core components

Node types

  • SubagentNode - Multi-tool composite node (Recommended)
  • Additional node types documentation coming soon

Testing & deployment

Complete example

from kapso.builder import Agent
from kapso.builder.nodes import SubagentNode, HandoffNode, WarmEndNode
from kapso.builder.tools import WebhookTool, KnowledgeBaseTool
from kapso.builder.agent.constants import START_NODE, END_NODE

# Create an agent
agent = Agent(
    name="customer_support",
    system_prompt="You are a helpful customer support assistant."
)

# Add required nodes
agent.add_node(START_NODE)
agent.add_node(END_NODE)

# Create main subagent with tools
subagent = SubagentNode(
    name="assistant",
    prompt="Help customers with their inquiries"
)

# Add tools to the subagent
subagent.add_tool(WebhookTool(
    name="check_order",
    url="https://api.example.com/orders/{{order_id}}",
    http_method="GET"
))

subagent.add_tool(KnowledgeBaseTool(
    key="faq",
    knowledge_base_text="Return Policy: 30 days..."
))

agent.add_node(subagent)

# Add global handoff
handoff = HandoffNode(
    name="human",
    global_=True,
    global_condition="user requests human or is frustrated"
)
agent.add_node(handoff)

# Add conversation end
end = WarmEndNode(
    name="goodbye",
    timeout_minutes=30,
    prompt="Thank the user"
)
agent.add_node(end)

# Define flow
agent.add_edge(START_NODE, "assistant")
agent.add_edge("assistant", "goodbye", condition="issue resolved")
agent.add_edge("goodbye", END_NODE)

# Validate and save
agent.validate()