Skip to main content
Variables are key-value pairs that can be referenced in workflow prompts using @variableKey syntax. When a workflow runs, Kadoa replaces variable references with the actual values. For an overview of variable concepts, data types, and usage in prompts, see Variables.

Prerequisites

  • Kadoa account with API key
  • SDK installed: npm install @kadoa/node-sdk
Variables are currently available in the Node SDK. Python SDK support is coming soon.

Create a Variable

const variable = await client.variable.create({
  key: "target_url",
  value: "https://example.com/products",
  dataType: "STRING",
});

console.log("Variable created:", variable.id);

Data Types

TypeDescriptionExample
STRINGPlain text (default)"ESG reports"
NUMBERNumeric values"25"
BOOLEANTrue/false"true"
JSONStructured JSON data'{"zip": "10001"}'
Values are always passed as strings, regardless of data type.

List Variables

const variables = await client.variable.list();

for (const variable of variables) {
  console.log(`${variable.key}: ${variable.value} (${variable.dataType})`);
}

Get a Variable

const variable = await client.variable.get("VARIABLE_ID");

console.log(variable.key);
console.log(variable.value);
console.log(variable.dataType);

Update a Variable

Workflows referencing this variable via @key will use the new value on their next run.
const updated = await client.variable.update("VARIABLE_ID", {
  value: "https://example.com/products/v2",
});

console.log("Variable updated:", updated.key);

Delete a Variable

Deleting a variable is permanent. Workflows referencing it via @key will no longer resolve the value.
await client.variable.delete("VARIABLE_ID");

Using Variables in Prompts

Reference variables in workflow prompts with @variableKey:
// Create a variable
await client.variable.create({
  key: "search_term",
  value: "ESG reports",
  dataType: "STRING",
});

// Use it in a workflow prompt — Kadoa replaces @search_term at runtime
const workflow = await client
  .extract({
    urls: ["https://sandbox.kadoa.com/ecommerce"],
    name: "Variable-Driven Search",
    userPrompt: "Search for @search_term and extract all matching results",
    extraction: (builder) =>
      builder
        .entity("Result")
        .field("title", "Result title", "STRING")
        .field("url", "Result URL", "LINK"),
  })
  .create();