Custom Provider Example
This example demonstrates how external Go developers can implement their own LLM backend and plug it seamlessly into VibeCoding's advanced Agent framework.
How it Works
VibeCoding provides a public Provider interface:
type Provider interface {
Chat(ctx context.Context, params ChatParams) <-chan StreamEvent
Name() string
Models() []ModelInfo
GetModel(id string) *ModelInfo
}
In this example, we:
- Implement a
CustomProvider struct that embeds agent.BaseProvider.
- Define a custom mock model (
mock-model).
- Implement the
Chat method to stream mock replies.
- Integrate keywords to trigger:
- Text Streaming: Simulates a standard delta-by-delta response stream.
- Tool Execution Request: Simulates the LLM deciding to read a file (
README.md) by sending a StreamToolCall event with a ToolCallBlock.
- Run the VibeCoding agent loop with this custom provider.
Notice how VibeCoding's built-in tool registry automatically intercepts the LLM's StreamToolCall event, runs the actual read tool against the workspace safely, and provides the result back to the assistant!
How to Run
- Make sure you are in the root directory of the project.
- Run the example:
go run example/custom_provider/main.go