cd /news/ai-tools/go-llm-sdk-for-streaming-tool-callin… Β· home β€Ί topics β€Ί ai-tools β€Ί article
[ARTICLE Β· art-80260] src=github.com β†— pub= topic=ai-tools verified=true sentiment=↑ positive

Go LLM SDK for streaming, tool-calling AI backends (plus frontend React lib)

Grafana released an open-source Go SDK for AI SDK that provides a unified API for calling language models, streaming responses, executing tools, and serving AI-powered endpoints from Go, with wire compatibility with Vercel's AI SDK React frontend hooks. The SDK supports multiple providers including Anthropic, Amazon Bedrock, OpenAI, and Grafana's hosted endpoint, and includes production controls for timeouts, fallback, logging, and Prometheus metrics.

read2 min views1 publishedJul 30, 2026
Go LLM SDK for streaming, tool-calling AI backends (plus frontend React lib)
Image: source

Call language models, stream responses, execute tools, and serve AI-powered endpoints from Go. Use the SDK on its own or pair it with an AI SDK React frontend.

The SDK gives Go applications one API for model calls, streaming, tools, structured output, and multi-step agents across supported providers. It follows the design of Vercel's AI SDK and stays wire-compatible with its TypeScript frontend hooks. A Go endpoint can stream Server-Sent Events (SSE) directly to hooks such as useChat

.

   Go backend                          React frontend
   ──────────                          ──────────────
   aisdk.StreamText(...)   ── SSE ──▢  useChat({ transport })
   aisdk.WriteUIMessageStream(w, …)    // same protocol

See How a request runs for the generation, tool, and streaming flow. Reuse an existing AI SDK React frontend or replace a TypeScript backend with Go without adding a protocol adapter.

β€” stream a response or wait for the complete result, with retries and multi-step tool executionStreamText

/GenerateText

React compatibilityβ€” serveuseChat

,useCompletion

, anduseObject

Composable toolsβ€” call plain Go functions from a model and require approval for consequential actions** Structured output**β€” generate schema-validated objects, arrays, and choices** Multiple providers**β€” call Anthropic, Amazon Bedrock, OpenAI, OpenAI-compatible APIs, and Grafana's hosted endpoint from internal services** Production controls**β€” configure timeouts, fallback, logging, Prometheus metrics, andAgent Observability

Create a Go project and install the core module and one provider:

mkdir ai-sdk-quickstart
cd ai-sdk-quickstart
go mod init example.com/ai-sdk-quickstart
go get github.com/grafana/ai-sdk
go get github.com/grafana/ai-sdk/providers/anthropic

See Choose a provider for Amazon Bedrock, OpenAI, OpenAI-compatible APIs, and the internally provisioned Grafana hosted endpoint.

Save this complete program as main.go

. It makes one model call and prints the response:

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	aisdk "github.com/grafana/ai-sdk"
	"github.com/grafana/ai-sdk/provider"
	"github.com/grafana/ai-sdk/providers/anthropic"
)

func main() {
	apiKey := os.Getenv("ANTHROPIC_API_KEY")
	if apiKey == "" {
		log.Fatal("ANTHROPIC_API_KEY is required")
	}

	model := anthropic.New(apiKey, "claude-sonnet-5")
	result, err := aisdk.GenerateText(context.Background(), model,
		aisdk.WithModelMessages(provider.UserText("Explain goroutines in one sentence.")),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(result.Text)
}

Run it with an Anthropic API key:

ANTHROPIC_API_KEY=sk-... go run .

For project initialization and credential guidance, follow Installation. To stream this response to a React client, continue with Build a full-stack chat.

Goal Start here
Make model calls from Go

Full-stack chatStructured outputToolsAgent loopsProvider overviewMiddleware overviewProduction checklistFull index: ** Documentation** Β· Runnable code:

Β· Exact APIs:

Examples

pkg.go.devContributions are welcome. CONTRIBUTING.md covers the development setup, the two conventions that make this repository unusual β€” upstream parity with the Vercel AI SDK, and spec-driven development with OpenSpec β€” and the pull request checklist. All participants follow our Code of Conduct.

Apache License 2.0. This SDK follows the design of Vercel's AI SDK, also Apache-2.0 licensed; attribution is recorded in NOTICE.

── more in #ai-tools 4 stories Β· sorted by recency
── more on @grafana 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/go-llm-sdk-for-strea…] indexed:0 read:2min 2026-07-30 Β· β€”