SQL and BFF
This page is mainly for skill authors, delivery engineers, and Agent maintainers. Business users usually should not need to know
sqlcodeorfunctionName.
The short version
When standard data commands are not enough, Lovrabet CLI can reuse business logic that already exists in the platform:
sql execfor complex queries and reporting logicbff execfor existing business workflows and unified business results
It also provides:
sql detailbff detail
for maintainers who need to inspect definitions and inputs.
Why there is no sql list or bff list
This is intentional.
SQL and BFF often encode real business logic and should not be freely explored by a generic agent without workflow boundaries.
The preferred design is:
- the business user describes the outcome they want
- a skill decides which SQL or BFF is allowed for that workflow
- the Agent executes within those boundaries
sql detail and sql exec
When SQL is a good fit
- complex multi-table queries
- reporting and metric logic
- reconciliation logic
- grouped summaries that go beyond simple
data aggregate
Inspect a SQL definition
lovrabet sql detail --sqlcode 2305f915-dd48cd4c
Execute a SQL definition
lovrabet sql exec --sqlcode 2305f915-dd48cd4c --params '{"date":"2026-04-20"}'
The sqlcode format is:
xxxxxxxx-xxxxxxxx
bff detail and bff exec
When BFF is a good fit
- a business result already exists as a runtime function
- multiple data sources or business steps are already packaged together
- you want a unified business snapshot or business response
Inspect a BFF definition
lovrabet bff detail --id 42
Here --id is the script ID, not the function name.
Execute a BFF
lovrabet bff exec --name processOrder --params '{"orderId":1,"action":"ship"}'
Here --name is the function name.
How to choose between SQL and BFF
| What you need | Better fit |
|---|---|
| standard single-dataset reads and writes | data commands |
| complex reporting or multi-table queries | sql exec |
| packaged business workflows or unified business responses | bff exec |
In simple terms:
- if it feels like “query logic,” lean toward SQL
- if it feels like “call an existing business function,” lean toward BFF
How business users should frame requests
Business users generally should not say:
- run
sqlcode=2305... - execute
functionName=processOrder
A better request is:
- generate yesterday’s operations summary
- give me a unified after-sales snapshot for this customer
- show me why this order did not move forward
Then the Agent and the skill can decide whether that means SQL or BFF behind the scenes.