Smarter LLM Client
Attention
The term ‘LLMClient’ is used interchangeably with ‘Agent’, ‘Workflow Unit’ and ‘Harness’ throughout this documentation.
Overview
The Smarter LLMClient is the platform’s implementation of what is commonly known as an LLM harness. It provides the execution environment surrounding a large language model, managing the prompts, conversation state, tool execution, configuration, security, and runtime behavior required to transform a foundation model into a reliable, production-ready application.
LLMClients support both interactive conversations with human users and fully automated workflows. In addition to orchestrating requests to a language model, they leverage the Smarter Plugin architecture to invoke tools, retrieve data from private systems, access external APIs, execute code, and integrate other runtime capabilities. This allows developers to extend the model far beyond text generation while maintaining consistent interfaces, security boundaries, and execution policies.
Each LLMClient is defined by a YAML-based :doc:Smarter API Manifest (SAM) <../smarter-framework/smarter-api>, which describes its model configuration, prompts, plugins, user interface, behavior, and other runtime characteristics. Because every aspect of an LLMClient is declaratively configured, developers can easily customize and deploy specialized AI applications without modifying framework code.
LLMClients are managed using the Smarter command-line interface (CLI).
Usage
A deployed LLMClient has its own host, e.g. https://stackademy-sql.3141-5926-5359.api.example.com,
with two endpoints, which answer POST requests only. /config/ returns the chat’s configuration and
a new chat session:
curl -X POST https://stackademy-sql.3141-5926-5359.api.example.com/config/ \
-H "Content-Type: application/json"
/prompt/ sends a prompt, and returns the LLM’s response, as JSON, whose assistant message is
Markdown:
curl -X POST https://stackademy-sql.3141-5926-5359.api.example.com/prompt/ \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "What courses are there?"}]}'
To continue a chat, send the session_key that /config/ returned, e.g.
{"session_key": "<SESSION-KEY>", "messages": [...]}, and the chat’s earlier messages. An LLMClient
with api keys requires one in every request: add -H "Authorization: Token <YOUR-API-KEY>".
An LLMClient is built from other SAM resources, each declared in its own manifest: the Provider whose
models it prompts, the plugins and MCPClients that give it tools, its Guardrails, its Custom Domain and
its api key, and beneath them what those use in turn, such as Connections and Secrets. The workbench’s
Console draws this tree in its Architecture tab, right of Manifest, as a card for each resource, with its
kind, its name and its owner. Clicking a card opens that resource’s manifest page, where its manifest can
be edited, in a new tab. The tree is the LLMClient broker’s dependency_tree(): see
Record Locators and Dependency Trees.
The workbench’s Console has a Deployment tab, its far right one, for what comes after
deploying: the LLMClient’s status and url, where to go from here, with the integrations that put its
chat on a web site (WordPress,
Drupal, Shopify,
the npm package and any html page), how to secure
its url, these commands, how its chat sessions work, and its manifest. The tab lists the account’s
api keys, creates one, showing its secret once, and attaches
it to the LLMClient, which then requires it, or detaches it. Attaching a key there is the same as
naming it in the manifest’s spec.apiKey and applying it: an LLMClient has one api key, and the
others are detached. Only the LLMClient’s owner or an account admin can attach a key, and only an
account admin can create one. An LLMClient that isn’t deployed shows the url that it will have, and
the command that deploys it.
A platform administrator can also show that page to browsers, with the enable_llmclient_endpoints_page
waffle switch, which is off by
default. A browser that opens a deployed LLMClient’s url, or either endpoint, then receives it, with
its api key steps written out rather than as forms, the LLMClient’s manifest without its owner’s
username, and links to The Smarter Project. While the switch is off, a GET of an endpoint is answered
405 Method Not Allowed.
The workbench, and the platform’s api, reach the same endpoints by the LLMClient’s id, at
/api/v1/llm-clients/<id>/config/ and /api/v1/llm-clients/<id>/prompt/, for a user who may read
the LLMClient: a logged-in user, or a request with that user’s Smarter api key.
See The Chat API Contract.
Web Pages That Embed It
A deployed LLMClient can be the chat backend of any web page, with
Smarter Chat, the @smarter.sh/ui-chat React component.
The page calls the LLMClient from the browser, so its origin must be allowed, in
spec.config.prompt.allowedOrigins:
spec:
config:
prompt:
allowedOrigins:
- https://www.example.com
- http://localhost:5173
Each origin is a scheme, a host and an optional port, without a path or a wildcard. If the LLMClient has an api key, the page must send one; without api keys, the LLMClient is public, and its prompts are charged to its owner. See Embedding Smarter Chat.
Staff-Only LLMClients
Some LLMClients are for the platform’s own staff, because their tools read what nobody else may see,
such as the platform’s pod logs and its users’ accounts. spec.config.prompt.staffOnly makes an
LLMClient visible and usable by the platform’s staff only:
spec:
config:
prompt:
staffOnly: true
The platform’s staff are the active staff users of the Smarter account, which runs the platform. An
account admin is staff of their own account only, and is not one of them, even as a superuser. Every
other user is told that a staff-only LLMClient doesn’t exist: it is in none of their lists, its
workbench and configuration answer 404 Not Found, and so do its prompt api and its deployed url.
Only the platform’s staff may apply a manifest with staffOnly: true.
The built-in smarter_sysadmin LLMClient, Smarter Sysadmin, is staff-only. It answers help desk and
operations questions with the
MCPServer’s staff-only tools, whose endpoint also
refuses everyone but the platform’s staff, so the two checks protect each other. initialize_platform
applies it to the Smarter account only: it is never copied into other accounts, and never deployed.
Model Settings
spec.config.prompt chooses the model and how it answers: defaultModel,
defaultTemperature, defaultMaxTokens, and, for a reasoning model, defaultReasoningEffort,
how much the model reasons before it answers: none, minimal, low, medium, high or
xhigh. Leave it out and the model reasons at its own default effort.
spec:
config:
prompt:
defaultModel: gpt-6.1-sol
defaultReasoningEffort: high
OpenAI’s models disagree about these settings. Some reasoning models support only some efforts, and
models that don’t reason, such as gpt-4o, support none of them. A reasoning model accepts only its
default temperature, 1.0, while it reasons. Some models use function tools (plugins, MCPClients and
extensions) only at reasoning effort none, and some, such as gpt-6.1-sol, can’t use them in the
chat completions api at all.
Smarter knows these rules for every OpenAI model that it offers, and applies them in two ways:
When a manifest is applied, settings that the model can never honor are errors, each with the settings to use instead. For example,
defaultReasoningEffort: minimalon gpt-6-luna, which suggestslow; plugins on gpt-6.1-sol, which suggestsdefaultModel: gpt-6-luna; ordefaultTemperature: 0.2withdefaultReasoningEffort: high.When a prompt is sent, settings that only some requests can use are changed for the requests that can’t, and Smarter Chat’s sandbox mode shows a warning that says what to change. For example, gpt-6-luna with tools and
defaultReasoningEffort: highreasons atnonein the requests that offer its tools, and athighin the answers without them. Smarter also learns the rules of a model that it doesn’t know, from the provider’s errors, and answers without the tools of a model that can’t use them, rather than fail.
Styling the Chat
An LLMClient’s manifest splits spec.config in two. prompt, which is required, is what the
LLMClient is: its LLM provider, model and system prompt, and the words of its chat. styles, which is
optional, is how its chat looks, in the workbench and on every page that embeds it: its logo, avatars,
background image, font and colors.
spec:
config:
prompt:
appName: Stackademy
appAssistant: Stanley
styles:
appLogoUrl: https://cdn.example.com/stackademy/logo.png
googleFont: Nunito
conversationHeader:
backgroundColor: "#14213d"
color: "#ffffff"
outgoingMessage:
backgroundColor: "#fca311"
No CSS or web development is needed. Styling Your LLMClient’s Chat explains every setting, with a crash course in colors, sizes, fonts and images, and a case study.
Example Manifest
apiVersion: smarter.sh/v1
kind: LLMClient
metadata:
name: stackademy_sql
description: Stackademy University course catalogue inquiries using the Stackademy SQL plugin.
version: 1.0.0
tags:
- stackademy
- sql
- llmclient
annotations:
- smarter.sh/llm-client/stackademy-sql/creator: QA Team
- smarter.sh/llm-client/stackademy-sql/purpose: llmclient for Stackademy course catalogue inquiries
- smarter.sh/llm-client/stackademy-sql/release-date: 2024-06-15
- smarter.sh/llm-client/stackademy-sql/backward-compatibility: true
- smarter.sh/llm-client/stackademy-sql/note: |
Uses SQL plugin to answer course catalogue questions.
Very fast and accurate when the database is well-structured.
Leverages cache for improved performance.
spec:
config:
prompt:
deployed: false
provider: openai
defaultModel: gpt-6-luna
defaultSystemRole: >
You are a helpful assistant. When given the opportunity to utilize
function calling, you should always do so. This will allow you to
provide the best possible responses to the user. DO NOT GUESS. IF
YOU DON'T KNOW THE ANSWER, RESPOND THAT YOU DON'T KNOW.
defaultTemperature: 1.0
defaultMaxTokens: 1024
appName: Stackademy SQL
appAssistant: Stanley
appWelcomeMessage: Welcome to Stackademy! How can I help you today?
appExamplePrompts:
- "Do you offer any courses on AI?"
- "My budget is $1,000. What courses can I take?"
- "I want to study programming. What do you suggest?"
appPlaceholder: "Ask me anything about Stackademy courses..."
appInfoUrl: https://stackademy.edu/online-courses
styles: # Stackademy's colors
# appLogoUrl: https://cdn.smarter.sh/images/llmclients/stackademy/logo.png # coming soon: upload, then uncomment
# appBackgroundImageUrl: https://cdn.smarter.sh/images/llmclients/stackademy/background.png # coming soon: upload, then uncomment
# assistantAvatarUrl: https://cdn.smarter.sh/images/llmclients/stackademy/assistant.png # coming soon: upload, then uncomment
googleFont: Nunito
fontSize: 15px
borderRadius: 16px
conversationHeader:
backgroundColor: '#14213d'
color: '#ffffff'
infoColor: '#fca311'
messageList:
backgroundColor: rgba(255, 255, 255, 0.85)
color: '#14213d'
incomingMessage:
backgroundColor: '#e5e5e5'
color: '#14213d'
linkColor: '#0b57d0'
outgoingMessage:
backgroundColor: '#fca311'
color: '#14213d'
messageInput:
backgroundColor: '#ffffff'
editorBackgroundColor: '#f1f1f1'
placeholderColor: '#6c757d'
buttons:
color: '#fca311'
typingIndicator:
color: '#fca311'
plugins:
- stackademy_sql
From llm-clients/stackademy-sql.yaml in the Stackademy example project.
Technical Reference
Sandbox Mode
Smarter LLMClients can be operated in a ‘Sandbox Mode’, which restricts their capabilities to ensure safe experimentation and testing. In this mode, llmclient are only addressable using URL schemes that authenticate with Django sessions. That is, they cannot be accessed via API keys nor will they function using URL schemas such as stackademy.1234-5678-9012.api.example.com.
An example sandbox mode url:
https://platform.smarter.sh/workbench/stackademy-sql/chat/
Deploying
Deploy a Smarter LLMClient using the Smarter CLI. For example:
smarter deploy llmclient stackademy-sql
smarter deploy llmclient -h
Deploys a LLMClient:
smarter deploy llmclient <name> [flags]
The Smarter API will deploy the LLMClient.
Usage:
smarter deploy llmclient <name> [flags]
Flags:
-h, --help help for llmclient
Global Flags:
--api_key string Smarter API key to use
--config string config file (default is $HOME/.smarter/config.yaml)
--environment string environment to use: local, alpha, beta, next, prod. Default is prod
-o, --output_format string output format: json, yaml (default "json")
-v, --verbose verbose output
Updating
Update a Smarter LLMClient using the Smarter CLI. For example:
smarter apply -f path/to/llmclient-manifest.yaml
Deleting
Delete a Smarter LLMClient using the Smarter CLI. For example:
smarter delete llmclient stackademy-sql
Testing
Test your Smarter LLMClient using the Smarter Workbench while in Sandbox Mode.
Monitoring
Use ad hoc Sql queries to monitor your Smarter LLMClient’s production performance and usage.
See:
smarter.apps.llmtool.models.PluginSelectorHistory
Scaling
If you use Kubernetes Smarter LLMClients will scale seamlessly with demand. See https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ for more information.
Trouble Shooting
Beyond the Django models listed above, you should also check the smarter pod logs for any errors. Use the following command to view the logs:
kubectl logs -n <namespace> <smarter-pod-name>
for example,
kubectl logs -n smarter-platform-prod smarter-68f445c866-59lmp