How to Construct a Workflow

This guide will walk you through how to construct a KRNL Studio workflow that fetches real estate data, analyzes it with AI, and encodes the results for on-chain submission.

We’ll break it down step by step so you understand what each part of the workflow does, and then show you the final JSON config you’ll use.

⏱ Time to complete: ~15 minutes

What You’ll Build

A workflow that:

  1. Fetches property data from Zillow (mocked API in this example)

  2. Fetches market estimates (value, rent, etc.)

  3. Runs an AI property analysis (GPT-based)

  4. Encodes the results into an EVM transaction

  5. Prepares it for blockchain submission with cryptographic proof

Step 1: Launch KRNL Studio

Open https://studio.krnl.xyz in your browser. You should see the KRNL Studio interface.

Step 2: Set Up Your Workflow Foundation

Create a New Workflow

  1. Click "Start Building"

  2. Name your workflow: Real Estate Investment Analyzer

  3. Select Sepolia Testnet as the Blockchain Network

  4. Paste the target contract address (deployed in Local Dev)

  5. Next you will have option to fetch your ABI automatically from Etherscan or manually input the ABI

  6. Finally you will have a canvas with pre-filled nodes

The canvas will display the default nodes:

  • Basic Info: Workflow metadata and configuration

  • dApp Config: Target contract settings

  • Workflow Steps: To add custom workflow steps

Configure Basic Information

  1. Hover over Basic Info node and click on the settings

  2. You might see all the fields already filled in

  3. After verifying the fields, let's move on to the next node

Configure dApp Information

  1. Hover over the dApp Config node and click on the settings

  2. You might see all the fields already filled in

  3. Again after verifying the fields, let's move on to the next node

Step 3: Add Workflow Steps

Add a Property Data Fetcher Step

  1. Click on Add Node and drag and drop the HTTP GET under HTTP step into the workflows

  2. Hover over the step and click on settings

  3. First, let's name it property-data-fetcher (This name could be anything you like)

Configure the API Request

  • In the settings page, there is a section called Inputs, under this configure your API request

  • URL: https://poc.platform.lat/zillow/webservice/GetSearchResults.htm?zws-id=demo-api-key&address=1234-Maple-Street&citystatezip=Austin,TX

  • Method: GET

Set Outputs

  • zpidresponse.body.searchResults.zpid

  • address.streetresponse.body.searchResults.address.street

  • address.cityresponse.body.searchResults.address.city

  • address.stateresponse.body.searchResults.address.state

  • address.zipcoderesponse.body.searchResults.address.zipcode

Close the Settings.

Add a Market Data Fetcher Step

  1. Click on Add Node and drag and drop the HTTP GET under HTTP step into the workflows

  2. Hover over the step and click on settings

  3. First, let's name it market-data-fetcher (This name could be anything you like)

Configure the API Request

  • URL: https://poc.platform.lat/zillow/webservice/GetZestimate.htm?zws-id=demo-api-key&zpid=${property-data-fetcher.zpid}

  • Method: GET

Set Outputs

  • zestimate.amount.valueresponse.body.zestimate.amount.value

  • zestimate.amount.currencyresponse.body.zestimate.amount.currency

  • zestimate.rent.valueresponse.body.zestimate.rentZestimate.value

  • zestimate.rent.currencyresponse.body.zestimate.rentZestimate.currency

  • property.bedroomsresponse.body.property.bedrooms

  • property.bathroomsresponse.body.property.bathrooms

  • property.finishedSqFtresponse.body.property.finishedSqFt

  • property.yearBuiltresponse.body.property.yearBuilt

  • property.typeresponse.body.property.propertyType

Close the Settings.

Add an AI Node

  1. Click on Add Node and drag and drop the OpenAI GPT under AI Assistant step into the workflows

  2. Hover over the step and click on settings

  3. First, let's name it ai-property-analysis (This name could be anything you like)

Configure the AI Request

  • URL: https://api.openai.com/v1/chat/completions

  • Method: POST

  • Headers:

    {
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Authorization": "Bearer ${_SECRETS.OPENAI_API_KEY}"
    }
  • Body:

    {
      "model": "gpt-4o-mini",
      "temperature": 0,
      "response_format": { "type": "json_object" },
      "messages": [
        { "role": "system", "content": "You are a professional real estate analyst. Only output valid JSON." },
        { "role": "user",
          "content": "Analyze this property for investment potential. Property: ${property-data-fetcher.address.street}, ${property-data-fetcher.address.city}, ${property-data-fetcher.address.state} ${property-data-fetcher.address.zipcode}. Bedrooms: ${market-data-fetcher.property.bedrooms}, Bathrooms: ${market-data-fetcher.property.bathrooms}, SqFt: ${market-data-fetcher.property.finishedSqFt}, Year Built: ${market-data-fetcher.property.yearBuilt}, Type: ${market-data-fetcher.property.type}. Zillow Estimate: ${market-data-fetcher.zestimate.amount.value}(${market-data-fetcher.zestimate.amount.currency}). Rent: ${market-data-fetcher.zestimate.rent.value}(${market-data-fetcher.zestimate.rent.currency}). Return JSON: { recommendation: INVEST/HOLD/PASS, property_value: number*10^20, investment_grade: A+/A/B+/B/C+/C/D, expected_annual_yield: number*10^18, confidence: number (1-100), invest_value: number * 10^18 }."
        }
      ]
    }

Set Outputs

  • ai_analysis.resultresponse.body.choices.0.message.content

Close the Settings.

Step 4: Construct & Submit EVM Payload

This node will be automatically added as soon as you add the first step in the workflow. Now click on edit to open the settings

Configure Parameters -> Expected Response in the contract

Under the settings we need to first configure the response fields which are expected by the target smart contract, in our case,

confidence -> uint256
expectedAnnualYield -> uint256
investmentGrade -> string
propertyValue -> uint256
recommendation -> string

Map Parameters -> Expected Response in the contract

As we have configured the field as components under Configuration in the Settings. Now we can map the workflow results to the fields as per the requirement, in our case this is how the mapping should look like where each field is being mapped via internal referencing of selective workflow steps.

propertyInfo: {
  confidence: "${ai-property-analysis.result.confidence}",
  expectedAnnualYield: "${ai-property-analysis.result.expected_annual_yield}",
  investmentGrade: "${ai-property-analysis.result.investment_grade}",
  propertyValue: "70000000000000000000000",
  recommendation: "${ai-property-analysis.result.recommendation}"
}

Set Outputs

  • No change needed

Close the Settings.

Step 5: Preview, Save, and Export

  1. Verify all connections

  2. Check node outputs

  3. Save workflow (auto-save enabled)

  4. Export workflow: Workflow Name → Export → Download JSON

Last updated