Skip to main content

Business Tool Runtime

This is the single canonical explanation of how Business Tools execute. REST/OpenAPI and Backend SDK share one pipeline; they diverge only at the outbound execution step.

System architecture

PathQefro roleYour backend
REST / OpenAPIHTTP client with encrypted credentialsExisting HTTPS API
Backend SDKSigned webhook caller@qefro-ai/backend handlers

Admin model: WorkspaceIntegrationBusiness Tool (implementation_kind: rest or sdk). SDK Connections are org-scoped until Sync Tools registers handlers into a workspace.

Execution pipeline

Stage reference

StageRESTBackend SDK
Tool selectionWorkspace-scoped enabled toolsSame
Callable filterChannel, auth level, END_USER_IDENTITY rulesSame
Input validationinput_schemaSame
Variable resolutionURL {placeholders}, conversation varsparameters + lookup.required
AuthenticationAPI_KEY, BEARER_TOKEN, END_USER_IDENTITYConnection signing secret
Preconditionslookup.required, org challengeSame
ConfirmationOptional explicit confirm for writesSame
ExecutionHTTPS to your APItool.invoke / tool.resume
Loggingtool_execution_logsSame

Workspace binding

tenant_id + workspace_id → list_enabled_tools → filter tool_callable_from_chat(auth_ctx)

Without a workspace on the Widget, no Business Tools load — answers come from the knowledge base only.

Authentication layers

Do not confuse these — full philosophy: Authentication.

LayerExample
Tool credentialAPI key, service bearer, SDK signing secret
End-user identitywidget.identify() → REST END_USER_IDENTITY
Organization challengeSDK customer.authorize() OTP
Required auth levelpublic, verified_channel, organization_challenge

Preconditions and Challenge / Resume

  • lookup.required — Runtime resolves email/phone before SDK invoke. See Identity resolution.
  • Challenge / Resume — SDK authorize() returns challenge → user replies → tool.resume. See Challenge / Resume.

Confirmation

High-risk writes may require an explicit user confirmation before execution. Prefer idempotent APIs; confirmation complements — does not replace — API-side authorization.

ToolResult

The LLM grounds replies in structured JSON from your API or SDK handler. Return clear found / error codes and optional message fields.

Debugging

SymptomLikely cause
Knowledge-base-only answersMissing workspace or disabled tools
Portal blocks toolEND_USER_IDENTITY is Widget/WhatsApp-only
REST 401Wrong encrypted secret — use Test Tool
customer_not_foundSDK directory lookup mismatch
OTP stuckChallenge/resume not handled

Full table: Troubleshooting.