Skip to main content
Build conversational agents with Python. Agents use LLMs for reasoning, flows are deterministic WhatsApp workflows. Flows automatically inherit the WhatsApp configuration from the active conversation. Specify whatsapp_config_id on individual nodes only when you need to override that default.

Quickstart

from kapso.builder.flows import Flow
from kapso.builder.flows.nodes import StartNode, SendTextNode, WaitForResponseNode, DecideNode
from kapso.builder.flows.nodes.decide import Condition

# Create flow
flow = Flow(name="support_flow")

# Add nodes
start = StartNode(id="start_1234")
greeting = SendTextNode(
    id="greeting_5678",
    message="Hi! How can I help you today?"
)
wait = WaitForResponseNode(
    id="wait_9012"
)
decide = DecideNode(
    id="decide_3456",
    provider_model_name="claude-sonnet-4-20250514",
    conditions=[
        Condition(label="order_help", description="Customer needs order help"),
        Condition(label="general", description="General question")
    ]
)
order_response = SendTextNode(
    id="order_response_7890",
    message="I'll help you with your order. Can you provide your order number?"
)
general_response = SendTextNode(
    id="general_response_1234",
    message="I'm here to help! What would you like to know?"
)

flow.add_node(start)
flow.add_node(greeting)
flow.add_node(wait)
flow.add_node(decide)
flow.add_node(order_response)
flow.add_node(general_response)

# Connect nodes
flow.add_edge("start_1234", "greeting_5678")
flow.add_edge("greeting_5678", "wait_9012")
flow.add_edge("wait_9012", "decide_3456")
flow.add_edge("decide_3456", "order_response_7890", label="order_help")
flow.add_edge("decide_3456", "general_response_1234", label="general")

flow.validate()
Deploy with kapso flow push support_flow
I