{"slug": "go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib", "title": "Go LLM SDK for streaming, tool-calling AI backends (plus frontend React lib)", "summary": "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.", "body_md": "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.\n\nThe SDK gives Go applications one API for model calls, streaming, tools,\nstructured output, and multi-step agents across supported providers. It follows\nthe design of [Vercel's AI SDK](https://ai-sdk.dev) and stays wire-compatible\nwith its TypeScript frontend hooks. A Go endpoint can stream Server-Sent Events\n(SSE) directly to hooks such as `useChat`\n\n.\n\n```\n   Go backend                          React frontend\n   ──────────                          ──────────────\n   aisdk.StreamText(...)   ── SSE ──▶  useChat({ transport })\n   aisdk.WriteUIMessageStream(w, …)    // same protocol\n```\n\nSee [How a request runs](/grafana/ai-sdk/blob/main/docs/concepts/architecture.md) for the generation,\ntool, and streaming flow. Reuse an existing AI SDK React frontend or replace a\nTypeScript backend with Go without adding a protocol adapter.\n\n— stream a response or wait for the complete result, with retries and multi-step tool execution`StreamText`\n\n/`GenerateText`\n\n**React compatibility**— serve`useChat`\n\n,`useCompletion`\n\n, and`useObject`\n\n**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, and[Agent Observability](/grafana/ai-sdk/blob/main/docs/middleware/agent-observability.md)\n\nCreate a Go project and install the core module and one provider:\n\n```\nmkdir ai-sdk-quickstart\ncd ai-sdk-quickstart\ngo mod init example.com/ai-sdk-quickstart\ngo get github.com/grafana/ai-sdk\ngo get github.com/grafana/ai-sdk/providers/anthropic\n```\n\nSee [Choose a provider](/grafana/ai-sdk/blob/main/docs/providers/overview.md) for Amazon Bedrock, OpenAI,\nOpenAI-compatible APIs, and the internally provisioned Grafana hosted endpoint.\n\nSave this complete program as `main.go`\n\n. It makes one model call and prints the\nresponse:\n\n```\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\taisdk \"github.com/grafana/ai-sdk\"\n\t\"github.com/grafana/ai-sdk/provider\"\n\t\"github.com/grafana/ai-sdk/providers/anthropic\"\n)\n\nfunc main() {\n\tapiKey := os.Getenv(\"ANTHROPIC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"ANTHROPIC_API_KEY is required\")\n\t}\n\n\tmodel := anthropic.New(apiKey, \"claude-sonnet-5\")\n\tresult, err := aisdk.GenerateText(context.Background(), model,\n\t\taisdk.WithModelMessages(provider.UserText(\"Explain goroutines in one sentence.\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(result.Text)\n}\n```\n\nRun it with an Anthropic API key:\n\n```\nANTHROPIC_API_KEY=sk-... go run .\n```\n\nFor project initialization and credential guidance, follow\n[Installation](/grafana/ai-sdk/blob/main/docs/getting-started/installation.md). To stream this response to\na React client, continue with [Build a full-stack chat](/grafana/ai-sdk/blob/main/docs/getting-started/full-stack-chat.md).\n\n| Goal | Start here |\n|---|---|\n| Make model calls from Go |\n|\n\n[Full-stack chat](/grafana/ai-sdk/blob/main/docs/getting-started/full-stack-chat.md)[Structured output](/grafana/ai-sdk/blob/main/docs/guides/structured-output.md)[Tools](/grafana/ai-sdk/blob/main/docs/guides/tools.md)[Agent loops](/grafana/ai-sdk/blob/main/docs/guides/agent-loops.md)[Provider overview](/grafana/ai-sdk/blob/main/docs/providers/overview.md)[Middleware overview](/grafana/ai-sdk/blob/main/docs/middleware/overview.md)[Production checklist](/grafana/ai-sdk/blob/main/docs/best-practices/production.md)Full index: ** Documentation** · Runnable code:\n\n**· Exact APIs:**\n\n[Examples](/grafana/ai-sdk/blob/main/examples)\n\n[pkg.go.dev](https://pkg.go.dev/github.com/grafana/ai-sdk)Contributions are welcome. [CONTRIBUTING.md](/grafana/ai-sdk/blob/main/CONTRIBUTING.md) covers the\ndevelopment setup, the two conventions that make this repository unusual —\nupstream parity with the Vercel AI SDK, and spec-driven development with\nOpenSpec — and the pull request checklist. All participants follow our\n[Code of Conduct](/grafana/ai-sdk/blob/main/CODE_OF_CONDUCT.md).\n\n[Apache License 2.0](/grafana/ai-sdk/blob/main/LICENSE). This SDK follows the design of\n[Vercel's AI SDK](https://github.com/vercel/ai), also Apache-2.0 licensed;\nattribution is recorded in [NOTICE](/grafana/ai-sdk/blob/main/NOTICE).", "url": "https://wpnews.pro/news/go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib", "canonical_source": "https://github.com/grafana/ai-sdk", "published_at": "2026-07-30 11:55:39+00:00", "updated_at": "2026-07-30 13:34:58.751045+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "developer-tools", "generative-ai", "large-language-models"], "entities": ["Grafana", "Vercel", "Anthropic", "Amazon Bedrock", "OpenAI", "Go", "React"], "alternates": {"html": "https://wpnews.pro/news/go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib", "markdown": "https://wpnews.pro/news/go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib.md", "text": "https://wpnews.pro/news/go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib.txt", "jsonld": "https://wpnews.pro/news/go-llm-sdk-for-streaming-tool-calling-ai-backends-plus-frontend-react-lib.jsonld"}}