Hi , can you help me how to create workflow?
# ask-ai
p
Hi , can you help me how to create workflow?
t
Thanks for reaching out, Varchasva. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I can help you create a workflow. Do you want to build it visually in the Agent Builder (browser) or programmatically with the SDK (Python/Node.js)? Also, what’s your goal for the workflow (e.g., lead qualification, intake form, booking, consent capture)? Tell me your preferred method and use case and I’ll give step‑by‑step guidance. Sources: Logic and structure overview | LiveKit Documentation | Workflows | LiveKit Documentation | Tasks and task groups | LiveKit Documentation, with interactive elements
p
I want to write dynamic code so any workflow can be configured from it ?
t
Great — we can do that. A few quick questions to tailor the guidance: 1. Which language do you want to use: Python or Node.js? 2. Do you want workflows defined from a config file (JSON/YAML) or built via a programmatic API at runtime? 3. Will you need support for prebuilt tasks (note: prebuilt tasks currently available in Python) or only custom tasks/tools? 4. Do you need runtime editing of workflows while sessions run, or just dynamic creation before sessions start? Answer these and I’ll provide a concrete pattern and sample code for building configurable workflows. , with interactive elements
p
I wan to use python , but I am pasting agent object which I am using
Copy code
"workflow": {
    "start_node_id": "node_start",
    "variables": [
      {
        "name": "patient_name",
        "type": "string",
        "default": ""
      },
      {
        "name": "phone_number",
        "type": "string",
        "default": ""
      },
      {
        "name": "visit_reason",
        "type": "string",
        "default": ""
      },
      {
        "name": "is_emergency",
        "type": "boolean",
        "default": false
      },
      {
        "name": "preferred_date",
        "type": "string",
        "default": ""
      }
    ],
    "tools": [
      {
        "name": "check_availability",
        "description": "",
        "method": "GET",
        "url": "<https://api.dentists.com/availability>",
        "headers": {
          "Content-Type": "application/json"
        },
        "when_to_use": "Call this once the user provides a date they want to visit"
      }
    ],
    "kb": [],
    "nodes": [
      {
        "position": {
          "x": 149.5,
          "y": 117.5
        },
        "id": "node_start",
        "type": "start",
        "label": "Greeting",
        "first_message": "Hi, thanks for calling Joe's Dentistry! I'm an AI assistant here to help you book an appointment.",
        "instructions_override": "Your goal in this node is to:\n1. Greet the caller warmly.\n2. Ask for their name and the reason for their visit.\n3. Use the set_variable tool to save their name into the 'patient_name' variable.\n4. Once you have both pieces of information, call signal_workflow_transition(intent='intro_done').\n",
        "tools_list": [],
        "kb_list": [],
        "max_turns": 5,
        "is_global": false,
        "data": {
          "store_response_to": "",
          "response_path": "",
          "timeout_seconds": 10,
          "retry": null,
          "condition_expression_syntax": "simple_compare",
          "conditions": [],
          "action": "",
          "end_reason": "",
          "handoff_target": ""
        }
      },
      {
        "position": {
          "x": 352.75,
          "y": 330.1666660308838
        },
        "id": "node_j575UK",
        "type": "condition",
        "label": "Check Urgency",
        "first_message": null,
        "instructions_override": "",
        "tools_list": [],
        "kb_list": [],
        "max_turns": null,
        "is_global": false,
        "data": {
          "store_response_to": "",
          "response_path": "",
          "timeout_seconds": 10,
          "retry": null,
          "condition_expression_syntax": "simple_compare",
          "conditions": [
            {
              "id": "NBkpud",
              "expression": "is_emergency == true",
              "label": "Emergency",
              "default": false
            },
            {
              "id": "sONWfr",
              "expression": "true",
              "label": "Routine",
              "default": true
            }
          ],
          "action": "",
          "end_reason": "",
          "handoff_target": ""
        }
      },
      {
        "position": {
          "x": 517.75,
          "y": 29.16666603088379
        },
        "id": "node_6K22Cy",
        "type": "conversational",
        "label": "Schedule Appointment",
        "first_message": null,
        "instructions_override": "Your goal is to help the user find an appointment slot.\n1. Use the check_availability tool. \n2. The AI will automatically ask for the date because it is marked as 'Required' in the tool parameters.\n3. Once the user selects a slot, call signal_workflow_transition(intent='slot_booked').",
        "tools_list": [
          "check_availability"
        ],
        "kb_list": [],
        "max_turns": 6,
        "is_global": false,
        "data": {
          "store_response_to": "",
          "response_path": "",
          "timeout_seconds": 10,
          "retry": null,
          "condition_expression_syntax": "simple_compare",
          "action": "",
          "end_reason": "",
          "handoff_target": "",
          "conditions": []
        }
      },
      {
        "position": {
          "x": 851.25,
          "y": 113.16666603088379
        },
        "id": "node_XMsW9J",
        "type": "handoff_end",
        "label": " End Conversation",
        "first_message": null,
        "instructions_override": "Thank the user and tell them they will receive a confirmation SMS soon.",
        "tools_list": [],
        "kb_list": [],
        "max_turns": 6,
        "is_global": false,
        "data": {
          "store_response_to": "",
          "response_path": "",
          "timeout_seconds": 10,
          "retry": null,
          "condition_expression_syntax": "simple_compare",
          "action": "end_call",
          "end_reason": "appointment_booked",
          "handoff_target": "",
          "conditions": []
        }
      },
      {
        "position": {
          "x": 690.75,
          "y": 337.1666660308838
        },
        "id": "node_aLCxq6",
        "type": "handoff_end",
        "label": "End / Handoff",
        "first_message": null,
        "instructions_override": "",
        "tools_list": [],
        "kb_list": [],
        "max_turns": 6,
        "is_global": false,
        "data": {
          "store_response_to": "",
          "response_path": "",
          "timeout_seconds": 10,
          "retry": null,
          "condition_expression_syntax": "simple_compare",
          "action": "end_call",
          "end_reason": "",
          "handoff_target": "",
          "conditions": []
        }
      }
    ],
    "edges": [
      {
        "id": "edge_UJ6M1n",
        "source": "node_start",
        "target": "node_j575UK",
        "trigger": "llm_intent",
        "condition": "intro_done",
        "label": "Name Captured",
        "default": false
      },
      {
        "id": "edge_U4pRAD",
        "source": "node_j575UK",
        "target": "node_6K22Cy",
        "trigger": "variable_condition",
        "condition": "sONWfr",
        "label": "New edge",
        "default": false
      },
      {
        "id": "edge_eJefO_",
        "source": "node_6K22Cy",
        "target": "node_XMsW9J",
        "trigger": "llm_intent",
        "condition": "slot_booked",
        "label": "Slot Booked",
        "default": false
      },
      {
        "id": "edge_oCebji",
        "source": "node_j575UK",
        "target": "node_aLCxq6",
        "trigger": "variable_condition",
        "condition": "NBkpud",
        "label": "Emergency Navigation",
        "default": false
      }
    ]
  },
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!