Skip to main content

SQL and BFF

This page is mainly for skill authors, delivery engineers, and Agent maintainers. Business users usually should not need to know sqlcode or functionName.


The short version

When standard data commands are not enough, Lovrabet CLI can reuse business logic that already exists in the platform:

  • sql exec for complex queries and reporting logic
  • bff exec for existing business workflows and unified business results

It also provides:

  • sql detail
  • bff 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 needBetter fit
standard single-dataset reads and writesdata commands
complex reporting or multi-table queriessql exec
packaged business workflows or unified business responsesbff 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.