Workbook, 16 November

On this page

The terminal in this workbook: on Windows the app Ubuntu, on a Mac the app Terminal. On Windows, never PowerShell: its line starts with PS C:\, and our commands do not work there.

First, three checks:

  1. Start kingo-pod. In the terminal, run:

    cd ~/kingo-pod && ./kingo up
    

    Then open n8n in your browser at http://localhost:5678, and Langflow at http://localhost:7860.

  2. Check that Claude Code starts, as in your homework:

    cd ~/kingo-pod && ./kingo claude
    

    Leave it with /exit. Then check your version of kingo-pod:

    cd ~/kingo-pod && ./kingo version
    

    You need 1.4.15 or newer (with Kingo 1.5: 1.5.14 or newer). Older? Run:

    cd ~/kingo-pod && ./kingo update
    
  3. Download ws2_s2.zip and unzip it (double-click it). The folder ws2_s2 holds:

    • ws2_s2_workbook.html: this page
    • today's slides, as HTML and as PDF
    • ws2_s2_team_a_ksmc.html, ws2_s2_team_b_kgoda.html, ws2_s2_team_c_k_motor.html: one page per team, for this afternoon
    • ws2_claude_model.html: how to change the model that Claude Code uses
    • the folder n8n: the workflows you import
    • the folders langflow, data and pages: for this afternoon
    • the folder contracts: what the Langflow flows take in and give back, in a technical format

Stuck at a step? Ask Claude Code. Start it, then tell it what you did and what you see:

cd ~/kingo-pod && ./kingo claude

On a Mac, you can even drag a screenshot into the terminal.

Block 1 · Build and use a simple webhook

You build a small workflow, Hello. Your browser calls n8n, and n8n answers. The node that waits for the call is a Webhook.

See what runs

  1. In the terminal, run:

    cd ~/kingo-pod && ./kingo status
    

    You see one line for each service, with its status and its address. n8n is at localhost:5678, Langflow at localhost:7860.

Build WS2.10 - Hello

  1. In n8n, click Create workflow. Click its name at the top and give it this name:

    WS2.10 - Hello
    
  2. Add the first node: a Webhook (type Webhook into the search). Rename it webhook_hello. Set it like this:

    HTTP Method: GET (as it comes). Respond: Using 'Respond to Webhook' Node. Path:

    hello
    
  3. Click the dot on its right and add a Respond to Webhook node. Rename it send_greeting. Set it like this:

    Respond With: JSON. Response Body: switch it to Expression and paste:

    {{ { greeting: 'Hello, ' + ($json.query.name || 'you') } }}
    
  4. Try it. Click Execute workflow at the bottom. n8n now waits for a call. Open a new browser tab and go to this address. Put your own name in place of Mina:

    http://localhost:5678/webhook-test/hello?name=Mina
    

    The tab shows the greeting. In n8n, you see the run on the canvas.

  5. Publish the workflow: click Publish at the top. In the window that opens, click Publish again. Now the Production URL works too, without Execute workflow:

    http://localhost:5678/webhook/hello?name=Mina
    

Well done: your browser called n8n, and n8n answered "Hello, Mina". You built your first Webhook: an address where n8n waits for a call. This is how a page, a form or another app starts a workflow. Your own page uses exactly this in block 2.

Stuck? Import n8n/ws2_10_hello_solution.json. It gives you the finished workflow WS2.10 - Hello - SOLUTION. Publish yours or the solution, not both: they use the same address.

Block 2 · Let Claude Code build your page

You import a second workflow, Ask. It takes a question, asks Langflow, and sends the answer back. Then Claude Code writes a web page that sends your question to Ask.

Import WS2.11 - Ask

  1. In n8n, import ws2_11_ask.json from the folder n8n. You get the workflow WS2.11 - Ask.

  2. Look at its three nodes, from left to right:

    • webhook_ask: your page calls n8n here (a Webhook).
    • fetch_ask_mailbox: n8n calls your Langflow flow Ask Mailbox (an HTTP Request).
    • send_answer: n8n sends the answer back to your page (Respond to Webhook).

    Double-click fetch_ask_mailbox. Under Header Auth, it should say Langflow (Run API). If not, pick it. Close the node.

  3. Publish the workflow: click Publish at the top. In the window that opens, click Publish again.

  4. Try it. Open a second terminal window:

    • On Windows: open the Start menu, type Ubuntu, and open the app Ubuntu. Its line ends with $, for example mina@laptop:~$. Does it start with PS C:\? That is PowerShell: close it. (The + in the tab bar opens PowerShell too.)
    • On a Mac: in the Terminal, press Cmd+N.

    Run this line in the new window. It sends a question to n8n, as your page will do later:

    curl -s -X POST http://localhost:5678/webhook/ask -H 'Content-Type: application/json' -d '{"question": "Who arranges tours of the Enron trading floor?"}'
    

    After a few seconds, you see the answer. In n8n, open the tab Executions of WS2.11 and click the run. Double-click a node to see what came in and what went out.

Great: n8n takes a question, asks Langflow, and answers. This is the pattern of the whole course: n8n runs the steps, Langflow thinks. The Webhook takes the call, the HTTP Request asks Langflow. Your page only needs to know one address.

Webhook or HTTP Request? For each case: does someone call n8n (a Webhook), or does n8n call someone (an HTTP Request)?

Case Answer
A customer clicks Send on your page Webhook
n8n asks your Langflow flow Triage what to do with a mail HTTP Request
Another app tells n8n about a new order Webhook
n8n asks a bank for today's exchange rate HTTP Request
You open the approvals page of WS2.4 in your browser Webhook
Why

Webhook: someone calls n8n. That is the customer's page, the other app, and your browser with the approvals page. HTTP Request: n8n calls someone. That is Langflow, and the bank.

If you like: three searches at once

The lecture's demo page asks three workflows at the same time. One answers at once, without AI. One answers briefly. One searches thoroughly. You can import them too.

  1. Import these three from the folder n8n:
    • ws2_11_ask_peek.json
    • ws2_11_ask_quick.json
    • ws2_11_ask_deeper.json
  2. Check their credentials. In WS2.11 - Ask - Peek, the node find_mails_with_the_words needs Mail (n8n_workshop_mail_n8n). In the other two, fetch_ask_mailbox needs Langflow (Run API).
  3. Publish all three, as above. Claude Code explains them to you in a moment.

The thorough one can take up to five minutes. It also uses more of your OpenRouter credit.

Start Claude Code, and see what it can reach

  1. In your first terminal window, start Claude Code:

    cd ~/kingo-pod && ./kingo claude
    
  2. Send this:

    What can you reach from your sandbox, and what not? Answer in five short lines:
    my files, my n8n, my Langflow, my database, the internet.
    

Good to know: Claude Code told you what it can reach. It can write only in ~/kingo-pod/claude. It can read the rest of kingo-pod. It reaches n8n, Langflow, your database and the internet. This fence is why you can let it work: it changes your tools, never the rest of your laptop.

If you imported the three searches: let Claude Code explain them

  1. Send this:

    Look at my n8n workflows WS2.11 - Ask - Peek, WS2.11 - Ask - Quick and WS2.11 - Ask - Deeper.
    In five short lines: what does each one do, which answers first, and which answers best?
    

Now you know what each search does, without opening a node. That is the point: Claude Code reads workflows and flows for you and explains them in plain words. Use it whenever you meet a workflow you do not know.

Let Claude Code write the page

  1. In n8n, check that WS2.11 - Ask is published: the Publish button shows a green dot.

  2. Claude Code checks pages with two tools: look takes a picture of a page, and clickthrough clicks through it in a browser of its own. That browser cannot reach n8n, so the request asks only for look. In Claude Code, send this:

    Write a web page: site/ask.html in your folder (~/kingo-pod/claude/site/ask.html).
    I open it myself in my browser, at http://localhost:8080/ask.html, through a
    web server that I start. So do not start a server, and do not open the page.
    
    The page:
    - has the title "Ask your mailbox", a box for a question, a button "Ask",
      and a place for the answer; Enter in the box asks too;
    - sends the question as JSON {"question": "..."} with POST to
      http://localhost:5678/webhook/ask; the reply is JSON {"answer": "..."};
    - shows "Thinking ..." while it waits, and turns the button off until the
      answer is there; an answer may take up to three minutes;
    - shows the answer as plain text, with its line breaks, never as HTML:
      it comes from mails;
    - says in plain words when n8n does not answer.
    One file, nothing loaded from the internet.
    
    Then check: look at the page with look. Call my n8n workflow WS2.11 - Ask
    once yourself, with one question. Do not try the page with clickthrough:
    there it cannot reach n8n. Tell me in three short lines what you checked.
    
  3. Claude Code writes the page, takes a picture of it with look, and calls your workflow once. Read its three lines.

Open your page

  1. You do this step, not Claude Code: Claude Code cannot open your browser, and the web server must keep running when Claude Code stops. In your second terminal window (on Windows: Ubuntu, not PowerShell), run this line. It starts a small web server: a program that hands your page to the browser.

    cd ~/kingo-pod && python3 -m http.server 8080 --bind 127.0.0.1 --directory claude/site
    

    It says Serving HTTP on 127.0.0.1 port 8080. Leave this window open. You need it in block 3 too.

  2. In your browser, open:

    http://localhost:8080/ask.html
    
  3. Ask your page:

    Who arranges tours of the Enron trading floor?
    

Your own page asks your mailbox! The page shows the answer, n8n runs the steps, Langflow thinks. Claude Code built the page in minutes. This is how you give people a simple way to use your AI: a page in front, n8n behind it. You decide what runs.

Want a change? Tell Claude Code, for example: Show my last three questions under the answer. Then reload the page in the browser.

Why a web server, and not a double-click on the file? A browser may block a page that was opened as a file when it calls localhost. A page that comes from localhost may call localhost.

Quiz. Your page opens, but says that n8n does not answer. What do you check first?

  • Whether Claude Code is still running
  • Whether WS2.11 - Ask is published
  • Whether the web server on port 8080 runs
Show the answer

Whether WS2.11 - Ask is published. The page opened, so the web server runs. Claude Code only wrote the page: it does not need to run. The address /webhook/ask works only while the workflow is published.

Block 3 · Let Claude Code improve the search flow

Your page asks the Langflow flow Ask Mailbox, through WS2.11. Now Claude Code makes that flow better. It works on a copy, so that the original keeps running while you test.

Choose what to improve

Think of the answer your page gave in block 2. What should be better? Take one of these ideas, or your own:

Let Claude Code make the copy and change it

  1. Copy this request into Claude Code, but do not press Enter yet. Claude Code shows a long paste as one short line, for example [Pasted text #1 +11 lines]: that is fine. Type your change after it, for example Search wider: the search returns twice as many mail threads. Then press Enter. The request has four parts: which flow, what must stay, how you check, and at the end your change.

    Make a copy of the Langflow flow Ask Mailbox (Enron) and name it
    "Ask Mailbox (Enron) - v2", with the endpoint name enron-ask-mailbox-v2.
    Put the copy into the same Langflow project (folder) as the original.
    
    In the copy, check every component that needs an OpenRouter API key: it must use
    the global variable OPEN_ROUTER_API_KEY. If the key is missing, set it.
    
    Do not change the original flow, and do not change n8n yet.
    Tell me how to test the copy in the Playground.
    
    In the copy only, change this:
    
  2. Claude Code asks before each step. Read what it wants to do, then agree.

Test the copy

  1. Reload Langflow in your browser. Open your project WS2 - Mail Assistant (Enron). The copy Ask Mailbox (Enron) - v2 is next to the original.

  2. Open the copy, click Playground, and ask the same question:

    Who arranges tours of the Enron trading floor?
    
  3. Is the answer better than on your page? If not, tell Claude Code what is still wrong. Then test again.

Switch it on

Your page still asks the original flow. Now let it ask the copy.

  1. In Claude Code, send this:

    Point my n8n workflow WS2.11 - Ask to the copy: in its node fetch_ask_mailbox,
    call the endpoint enron-ask-mailbox-v2 in place of enron-ask-mailbox.
    Change nothing else.
    
  2. Claude Code changes the workflow and asks you to publish it. Only Publish changes what runs. Publish it yourself: in n8n, reload the page and open WS2.11 - Ask. Click Publish at the top. In the window that opens, click Publish again. Or tell Claude Code: Publish WS2.11 - Ask.

  3. Reload your page, http://localhost:8080/ask.html, and ask the same question.

Your page answers with your better flow, and the original is unchanged. You improved an AI flow without risk: Claude Code changed a copy, you tested it, and you switched it on. This is how you change anything that already runs. Before Claude Code changes a flow or a workflow, it also saves a copy as a file in ~/kingo-pod/claude/backups/.

Quiz. The copy is better. Who decides that it runs?

  • Claude Code, by itself
  • You
  • Langflow, when you save the copy
Show the answer

You. You tested the copy, so you decide. You click Publish in n8n, or you tell Claude Code to publish. Claude Code does not publish by itself: it asks you. Until you publish WS2.11 again, n8n keeps calling the original.

Block 4 · Write your team's rules, together with Claude Code

Now, or this afternoon.

Claude Code reads the file AGENTS.md at every start. Its last part, Your team's rules, holds no rules yet, only three steps as a placeholder. Now you fill it in, together with Claude Code. Claude Code interviews you, you answer, Claude Code writes.

Let Claude Code interview you

  1. In Claude Code, send this:

    Interview us, one question at a time, and write our team's rules into AGENTS.md,
    under the heading "Your team's rules". Ask, then wait for our answer.
    First ask which project we have. Then look at our workflows in n8n and our flows in Langflow.
    Then go through these six principles, one at a time. For each, suggest our rule in one or
    two sentences, and ask us whether it fits or what to change:
    1. One task per piece: each flow does one job.
    2. A contract for each flow: which fields go in, which come out.
    3. One place for the data.
    4. A fixed rule decides; the model only proposes.
    5. Each part may do only what its job needs.
    6. Where a person decides.
    At the end, show us the whole text before you save it. Replace only the three steps under
    the heading. Leave everything above the heading as it is.
    
  2. Claude Code interviews you, one question at a time. Answer in a few words.

  3. Claude Code shows the whole text before it saves. Is it right? Say what to change, then agree.

Check that Claude Code knows your rules

  1. Leave Claude Code with /exit, and start it again:

    cd ~/kingo-pod && ./kingo claude
    
  2. Send this:

    What are our team's rules? Answer in six short lines.
    

Claude Code names your team's rules. From now on, every teammate's Claude Code builds the same way: your names, your contracts, where a person decides. Nobody has to explain it again in each session. Your teammates want the same rules? Send them the text under Your team's rules. Each pastes it into their own ~/kingo-pod/claude/AGENTS.md, under that heading (open the file as in the homework).

How do you start Claude Code? Match each situation with its command. All four start Claude Code inside the sandbox, nono.

Situation Command
Claude Code asks you before every command ./kingo claude
Claude Code works without asking you ./kingo yolo
Your own folder, for example for your thesis: no n8n, no Langflow ./kingo claude --in ~/projects/thesis
Your own Claude subscription pays, with Anthropic's models ./kingo claude --login
More about the four
  • In ./kingo claude, Shift+Tab switches the mode. In plan mode, for example, Claude Code first makes a plan and changes nothing until you agree.
  • ./kingo yolo asks nothing, but the sandbox stays. Your laptop stays protected.
  • --in takes a folder inside your home folder: not a Windows folder, and not kingo-pod. Claude Code can write only there. There it reads that folder's own CLAUDE.md or AGENTS.md, not your team's.
  • --login asks you to log in once, at the first start. You need no OpenRouter key.

Quiz. Which model does Claude Code use in the course, and where is that written?

  • Claude, from Anthropic, always
  • GLM 5.3 Flash through OpenRouter, written in claude/.claude/settings.json
  • The model of your Langflow flows
Show the answer

GLM 5.3 Flash, through OpenRouter. It is written in ~/kingo-pod/claude/.claude/settings.json. Want another model? The page ws2_claude_model.html in your download shows how.

An example: Anthropic's Claude Sonnet 5.5, with an Anthropic API key. The page shows it in four steps, under Use Anthropic's API, or another provider:

  1. Save the key in ~/.config/kingo/anthropic.key.
  2. Give the sandbox the route to Anthropic, in ~/kingo-pod/my-nono-profile.json.
  3. In settings.json, delete the line "ANTHROPIC_API_KEY": "",, and let the lines that name the model say Anthropic's models, for example claude-sonnet-5-5.
  4. Start ./kingo claude again.
Agentic AI in Business · Workshop II · Frank Huettner · SKK GSB.