Use runtime model calls from ProtoScript
Use ToAskModelViaBuffalyRuntime when a ProtoScript action needs one isolated model call through Buffaly's configured provider catalog, credentials, model selection, and reasoning settings.
function Execute(
string prompt,
string systemPrompt = "",
string provider = "",
string model = "",
string reasoningLevel = "",
string inputPartsJson = "[]"
) : stringWhat this path is for
Use it for isolated one-off model calls that should still use Buffaly's provider catalog, model selection, reasoning selection, credentials, and provider-specific transport configuration.
- Summarize documents in a separate tool context.
- Route calls to configured xAI, Gemini, Anthropic, OpenAI/Codex-backed, Ollama, or other provider-native modules.
- Use multimodal understanding when the selected provider/model supports supplied content parts.
Do not use this path for image generation, video generation, raw API-key calls, manually choosing a transport, or inheriting the active agent transcript.
How it works at a high level
- ProtoScript calls
ToAskModelViaBuffalyRuntime.Execute(...)or a thin wrapper. - Buffaly builds a fresh isolated model conversation from the supplied arguments.
- Buffaly resolves provider, model, reasoning level, credentials, and transport from the runtime provider catalog.
- The provider sends the request through its configured path.
- Buffaly returns compact JSON with status, text, provider/model/reasoning, and usage metrics.
Isolation rule
The model sees only systemPrompt, prompt, and ordered content parts from inputPartsJson. The active session supplies defaults, credentials, logging, and correlation, but the active chat transcript is not sent as context.
Arguments
| Argument | Meaning |
|---|---|
prompt | Primary instruction; required unless content parts include text. |
systemPrompt | Optional system instruction for this isolated call. |
provider, model | Optional explicit selection; empty values use configured defaults. |
reasoningLevel | Optional reasoning choice when the provider/model supports it. |
inputPartsJson | Ordered content parts for text and supported multimodal input. |
Content parts for multimodal understanding
Use content parts when the model should see multiple text chunks, files, or other supported multimodal inputs. Validate provider/model support first and keep the payload explicit rather than relying on the current transcript.
Reading the result
Success returns Status = ok, assistant Text, provider/model/reasoning, and usage metrics. Failure returns Status = failed, an explanatory Error, and empty text. Do not silently fall back to another provider unless that behavior is explicit.
Verify
- Start with a small prompt and confirm the selected provider/model are returned.
- Test a bad provider or model and confirm the failure is explicit.
- For multimodal input, validate the selected provider/model supports the supplied parts.