Guide

Building your first chatbot

Everything you need to go from a blank project to a chatbot that gives real answers — what each file does, which functions are available, and what to try next. No prior coding experience required.

What you're building

A chatbot is a program that reads a message and writes back a reply. Instead of programming every possible answer by hand, you write a short description of who the bot is and how it should behave — a real AI model does the actual answering, guided by your instructions.

Every project has exactly four files: config.py, prompt.py, logic.py, and main.py. Each one holds a different kind of decision, so you always know exactly where to make a change.

Create your account

  1. Open the platform and click Register.
  2. Sign up with an email and a password — this creates your own workspace and gives you starter tokens to run code and chat with your bot.
  3. From your dashboard, click New Project to open the code editor (the IDE).

Run your first bot

Every new project already has a working chatbot in it — you're customizing something real from the very first click, not starting from a blank page.

  1. Click Run in the top right of the editor.
  2. The console fills with a few lines confirming the bot started — that's normal.
  3. When the chat panel says Ready, type a question and press enter.

config.py

The settings drawer

config.py
# Settings for your chatbot live here. Change a value, save, and click Run
# to see it take effect — no need to touch any other file.
BOT_NAME = "Assistant"
One line: the chatbot's name. Change the text between the quotes to anything — "Chef Bot", "Study Buddy".

prompt.py

The personality drawer

prompt.py
# This is your chatbot's personality and instructions, in plain English.
# The AI reads this every single time before it answers — change it to turn
# your bot into anything: a friendly tutor, a joke-teller, a pirate, a quiz
# host. Just describe who it is and how it should behave.
SYSTEM_PROMPT = (
    "You are a helpful assistant. Answer the visitor's question clearly and "
    "concisely, in at most three sentences."
)
This is the job description. The AI re-reads it before every reply, so it's the single most powerful thing you can edit — this one paragraph of English is most of "the code."

logic.py

The thinking drawer

logic.py
# This is where your chatbot decides what to say back. "Logic" just means
# "the thinking part" — main.py hands each message to respond() below, and
# whatever respond() returns is sent back as the reply.
from ai import ask
from prompt import SYSTEM_PROMPT


def respond(message: str) -> str:
    # ask() sends your SYSTEM_PROMPT plus their message to the AI,
    # and gets a real answer back.
    return ask(f"{SYSTEM_PROMPT}\n\nVisitor says: {message}")
A recipe with one step: take whatever the visitor typed, hand it to the AI along with the personality from prompt.py, and send back whatever the AI says.

main.py

The on/off switch

main.py
# This is the starting point of your chatbot — the file that runs first.
from ai import *
from config import BOT_NAME
from logic import respond

bot = ChatBot(BOT_NAME)

# Whenever someone messages the chatbot, this runs and sends back the reply.
@bot.on_message
def handle_message(message):
    return respond(message)

bot.start()
This plugs the other three files together and switches the chatbot on. It rarely needs changing — the other three files are where the real customizing happens.

Functions you can use

Everything below is available the moment you write from ai import * at the top of a file — the same list shows up as autocomplete while you type in the editor, and ctrl+click on any of these names opens its real source code.

Ready to use

ChatBot(name: str = "Assistant")

A text chatbot.

@bot.on_message

ChatBot method. Decorator: registers the function below it as the handler called for every incoming message. The handler receives the visitor's message (str) and must return the reply (str).

bot.start()

ChatBot method. Starts the bot — the platform automatically exposes it as a live chat endpoint in the preview panel. Call this once, last, at module level.

ask(question: str) -> str

Ask the AI a question and get a text answer back.

reply(text: str) -> str

Same as ask() — reads more naturally inside a chatbot handler.

memory() -> Memory

Create a new, empty conversation memory buffer.

database() -> Database

Get a handle to this project's simple key-value database.

save(key: str, value) -> None

Save a value under a name so you can load() it later.

load(key: str, default=None)

Load a value previously saved with save().

create_table(name: str) -> Table

Create (or open) a named table for structured rows.

query(table: str, **filters) -> list[dict]

Query rows from a table made with create_table(), filtered by exact-match keyword arguments.

Coming in a future update

These already autocomplete and show docs in the editor so you can see what's planned, but calling them raises an error for now.

VoiceBot(name: str = "Assistant")

A voice chatbot: turns speech into text, runs your handler, turns the reply into speech.

speech_to_text(audio)

Convert spoken audio into text.

text_to_speech(text: str)

Convert text into spoken audio.

RAG(pdf)

Ask questions about a PDF's contents.

upload_pdf()

Upload a PDF for use with RAG().

vision(image)

Describe or classify what's in an image.

ocr(image)

Extract text from an image.

translate(text: str, to: str = "en") -> str

Translate text into another language.

search(query: str) -> list[dict]

Search the web (or a project's knowledge base) for information.

email(to: str, subject: str, body: str) -> None

Send an email.

sms(to: str, body: str) -> None

Send a text message.

workflow(*steps)

Chain multiple AI steps together into one pipeline.

agent(tools: list | None = None)

Create a tool-using AI agent that can call the functions you give it.

image(prompt: str)

Generate an image from a text description.

Ideas to try

Small edits, big changes. After each one: save, click Run, and chat again.

Give it a new name

In config.py, change BOT_NAME to anything you like.

Give it a new job

In prompt.py, rewrite SYSTEM_PROMPT — try "You are a pirate who answers in pirate slang."

Make it stricter

Add a rule like "Never answer in more than one sentence" and see what changes.

Troubleshooting

The chatbot just repeats back exactly what I typed.

That's the platform's offline fallback, used when a real AI connection isn't configured yet — check with your teacher or workshop organizer.

Red text showed up in the console.

That's Python explaining what went wrong — usually a missing quote mark or a typo. Read the last line for a hint, fix it, and click Run again.

I changed the code but nothing's different.

Changes only take effect after you click Run again.

Glossary

variable
A named box that holds a value — like BOT_NAME holding the text "Assistant".
string
Text, wrapped in quotes.
function
A named, reusable set of steps, like respond().
import
Borrowing code that's already written elsewhere.
AI model
The actual "brain" that reads the prompt and writes the reply.
run
Telling the computer to execute the code right now.