Comprehensive reference documentation for the Kapso Builder SDK
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()
Was this page helpful?