FrostAgent keeps its LLM communication behind theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GuaiZai233/FrostAgent/llms.txt
Use this file to discover all available pages before exploring further.
core.LLMProvider interface, so the engine’s reasoning loop never depends on a specific API vendor. Swapping providers — or adding support for a new one — means implementing a single method, wiring the new struct into main.go, and letting the engine continue without modification.
The LLMProvider interface
The interface is defined in internal/core/interfaces.go:
Chat can be used as a drop-in provider. The engine calls this method at every iteration of its reasoning loop, passing the full conversation history and the list of available tools.
ChatRequest and ChatResponse types
Both types are defined in internal/core/types.go and represent FrostAgent’s provider-neutral data model. Your implementation must convert between these types and whatever format your LLM API expects.
ChatRequest
ChatResponse
Usage is optional — set it to nil if your backend does not report token counts.
ChatMessage
MessageRole is a typed string with four defined constants:
| Constant | Value |
|---|---|
core.RoleSystem | "system" |
core.RoleUser | "user" |
core.RoleAssistant | "assistant" |
core.RoleTool | "tool" |
Tool (passed inside ChatRequest)
ToolCall and ToolCallFunction
Chat implementation must return a ChatMessage whose ToolCalls slice is populated. When the ToolCalls slice is empty, the engine treats the response as a final answer and stops iterating.
Built-in OpenAI provider
FrostAgent ships with an OpenAI-compatible provider ininternal/provider/llm/openai. Its constructor signature is:
openai.Client implements core.LLMProvider and handles all serialisation to and from the OpenAI chat completions format. It works with any OpenAI-compatible API, including:
- OpenAI (
https://api.openai.com/v1) - Alibaba Cloud DashScope (
https://dashscope.aliyuncs.com/compatible-mode/v1) - Local inference servers such as Ollama or vLLM that expose the
/chat/completionsendpoint
Bearer token in the Authorization header.
Implementing a custom provider
Create a new package underinternal/provider/llm/<yourprovider>/ and implement the interface:
Handling tool definitions
Your provider must also translate theTools slice inside ChatRequest into whatever format your API expects. For function-calling APIs this is typically:
Wiring it in
Replace theopenai.NewClient(...) call in the Engine initialisation block inside cmd/app/main.go:
.env. No other changes are needed — the engine’s run loop only calls Provider.Chat() and is unaware of the underlying transport.
Your provider must correctly populate
ToolCalls in the returned ChatMessage whenever the LLM decides to invoke a tool. If ToolCalls is empty, the engine interprets the response as a final answer and exits the loop immediately, even if the model’s raw output contained a tool-call intent in a different format. Always validate your response mapping with a test that exercises a multi-turn tool call before deploying to production.