Your First AI Application With Smarter, Part 2: The YAML Manifest Is the Application

A Smarter application is its YAML manifest. There’s nothing else to it, no code beside it and no settings hidden in a database that the file doesn’t describe. In Part 1, you pasted Stanley’s manifest into the web console, and Smarter turned it into a working chatbot. In this part, the manifest moves into a file in a git repository, where you’ll read it field by field, validate it, apply it with the Smarter command-line interface (CLI), give Stanley’s chat Stackademy’s colors, and commit each change, the way you’d manage any other source code.

The eight parts of the series, with Part 2 highlighted
Part 2 moves Stanley into a file under version control

Install the CLI

The CLI, smarter, is to Smarter what kubectl is to Kubernetes. On macOS or Linux, install it with Homebrew.

brew tap smarter-sh/tap https://github.com/smarter-sh/homebrew-tap
brew trust smarter-sh/tap
brew install smarter

Getting Started with Smarter’s CLI has the Ubuntu and Windows installs, and explains smarter configure, which asks for your account number, your username and an API key, and saves them for you. The CLI’s local environment is always http://localhost:9357, where the Quick Start runs. Make it the default when configure asks, then check that the CLI can reach your platform.

smarter whoami

It prints the API key’s owner and their account. If it does, every command below will work.

Put Stanley in a repository

Make a folder for the project, and put it under git.

mkdir stackademy-advisor
cd stackademy-advisor
git init

Save Stanley’s manifest as course-advisor.yaml. It’s the manifest from the end of Part 1, with the honesty instruction in its system prompt.

apiVersion: smarter.sh/v1
kind: LLMClient
metadata:
  name: course_advisor
  description: Answers students' questions about Stackademy's courses.
  version: 1.0.1
spec:
  config:
    prompt:
      provider: openai
      defaultModel: gpt-6-luna
      defaultSystemRole: >
        You are Stanley, a friendly student advisor at Stackademy, an online
        code academy. Answer questions about Stackademy's courses in a few
        short sentences. If you don't know something, say so. Never guess.
      appName: Stackademy Course Advisor
      appAssistant: Stanley
      appWelcomeMessage: Hi, I'm Stanley. What would you like to learn?
      appExamplePrompts:
        - Do you offer any courses on AI?
        - My budget is $1,000. What courses can I take?

Commit it.

git add course-advisor.yaml
git commit -m "Stanley, Stackademy's course advisor"

From now on, the file is the source of truth. The copy in Smarter is what you get when you apply it.

Read the manifest

An LLMClient manifest, with each section labeled
Every Smarter manifest has the same four parts

Every Smarter resource is declared the same way, in a Smarter Application Manifest, or SAM. If you’ve written a Kubernetes manifest, you’ve seen its shape.

  • apiVersion and kind say what the resource is. Smarter has about twenty-five kinds, and you’ll meet three more in Part 3.
  • metadata says who it is. The name is how every other manifest, the CLI and the API refer to it. The version is yours to manage, and Smarter keeps it with the resource, so that you can tell which file is running.
  • spec says what it does, and is different for each kind. An LLMClient’s spec.config.prompt is its model and what it says. spec.config.styles is how its chat looks. Lists like spec.plugins name the other resources that it uses.

Most fields are optional. Ask Smarter for the complete manifest, with every field it filled in for you.

smarter describe llmclient course_advisor -o yaml

The output starts like your file and goes on. Here’s part of it.

spec:
  apiKey: null
  config:
    prompt:
      allowedOrigins: []
      appFileAttachment: false
      defaultMaxTokens: null
      defaultTemperature: null
      deployed: false
      staffOnly: false
    styles: null
  guardrails: null
  mcpClients: null
  plugins: []
status:
  deployed: false
  url: http://localhost:9357/workbench/llm-clients/rMTAyMTA3NQx/

status is what Smarter reports about the resource, such as its URL and whether it’s deployed. You never write it. Keep your own file short, and use describe when you want the whole picture.

Validate before you apply

smarter validate checks a manifest against its kind’s schema without changing anything. Try a mistake. Add defaultTemperature: 3.5 under defaultModel, and validate.

smarter validate -f course-advisor.yaml
spec.config.prompt.defaultTemperature: Input should be less than or equal to 1

Error: manifest has 1 error(s)

Each error names the field, with the full path to it, and what’s wrong. Take the line out again, and the manifest is valid.

manifest is valid.

Validation catches wrong values and missing fields. It doesn’t catch a misspelled optional field, though. defaultModle: gpt-6-luna is a valid manifest, whose misspelled field Smarter ignores. When a setting seems to have no effect, compare your file with what smarter describe returns.

Give Stanley Stackademy’s colors

spec.config.styles changes how a chat looks, in the workbench and on every web page that embeds it. It takes a Google font, colors for each part of the chat, and image URLs for a logo, a background and avatars, without any CSS. Add these lines under spec.config, at the same indentation as prompt.

    styles:
      googleFont: Nunito
      borderRadius: 16px
      conversationHeader:
        backgroundColor: "#14213d"
        color: "#ffffff"
        infoColor: "#fca311"
      incomingMessage:
        backgroundColor: "#e5e5e5"
        color: "#14213d"
      outgoingMessage:
        backgroundColor: "#fca311"
        color: "#14213d"

Change version to 1.1.0, then validate and apply.

smarter validate -f course-advisor.yaml
smarter apply -f course-advisor.yaml
manifest is valid.
manifest applied.

Open Stanley in the workbench again.

Stanley's chat with a navy header and orange student messages
The same Stanley, in Stackademy’s colors

Styling Your LLMClient’s Chat explains every setting, with a short course in colors, fonts and images for people who’ve never written CSS.

Talk to Stanley from the terminal

The workbench isn’t the only way to try a change. smarter chat prompt sends one prompt and prints the platform’s whole response, as JSON, with the messages, the model’s settings, any tool calls and the tokens charged. To see only Stanley’s answer, pipe it through jq.

smarter chat prompt -l course_advisor --new_session \
  -p "Which AI courses do you have, and what do they cost?" \
  | jq -r '.data.response.data.body.choices[0].message.content'
I don't have Stackademy's current AI course catalog or pricing details available here. If you share the course list or a link, I can help compare them and their costs.

Stanley still doesn’t know the catalogue. Part 3 changes that.

Commit every change

git commit -am "Stackademy's colors for Stanley's chat"

That’s the whole workflow, and it’s the same for every kind of resource and every change you’ll make in this series.

Edit, validate, apply, try it and commit, in a loop
Every change goes around the same loop

The repository is now the application’s history. Each commit says what changed and why, a pull request can be reviewed before a change goes live, and an older version is one git checkout and one smarter apply away. The Stackademy repository manages a whole project of LLMClients, plugins, connections, secrets, budgets and accounts this way, and every Smarter platform loads it when it starts for the first time.

What’s next

Stanley lives in a file now, under version control, and you can change him from your editor and your terminal. In Part 3, he gets his first tool. Three new manifests give him Stackademy’s course catalogue API, with its API key kept in a Secret that the model never sees.