https://github.com/google/adk-go
An open-source, code-first Go toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.
https://github.com/google/adk-go
a2a agents agents-sdk ai aiagentframework gemini genai go llm mcp multi-agent-collaboration multi-agent-systems sdk vertex-ai
Last synced: 10 days ago
JSON representation
An open-source, code-first Go toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.
- Host: GitHub
- URL: https://github.com/google/adk-go
- Owner: google
- License: apache-2.0
- Created: 2025-05-05T17:16:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-07-27T15:25:07.000Z (10 days ago)
- Last Synced: 2026-07-27T17:08:57.630Z (10 days ago)
- Topics: a2a, agents, agents-sdk, ai, aiagentframework, gemini, genai, go, llm, mcp, multi-agent-collaboration, multi-agent-systems, sdk, vertex-ai
- Language: Go
- Homepage: https://google.github.io/adk-docs/
- Size: 28.6 MB
- Stars: 8,540
- Watchers: 95
- Forks: 855
- Open Issues: 289
-
Metadata Files:
- Readme: README-v2.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
- awesome-a2a - ADK Go - go?style=social)](https://github.com/google/adk-go) - Google's official open-source, code-first Go toolkit for building, evaluating, and deploying sophisticated AI agents with native A2A protocol support, MCP integration, multi-agent orchestration, and seamless Vertex AI / Gemini interoperability. Apache 2.0. (⚙️ Implementations & Libraries)
- AiTreasureBox - google/adk-go - 11-19_4081_129](https://img.shields.io/github/stars/google/adk-go.svg)|An open-source, code-first Go toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.| (Repos)
- StarryDivineSky - google/adk-go - go 是一个基于 Go 语言开发的开源工具包,旨在为开发者提供构建、评估和部署复杂 AI 代理(AI Agent)的灵活解决方案。项目采用代码优先的设计理念,通过模块化架构和清晰的 API 接口,支持从基础功能开发到高级逻辑实现的全流程控制。其核心特色包括对 AI 代理行为的精细化配置、可扩展的插件系统以及跨平台兼容性,允许开发者根据具体需求自定义代理决策逻辑、交互规则和执行策略。工具包内置了训练和推理框架,支持通过定义状态空间、奖励函数和动作空间来训练代理模型,并提供可视化调试工具辅助性能优化。项目特别强调对复杂场景的适应能力,例如多智能体协作、动态环境响应和长期目标规划,适用于自动化运维、游戏 AI、智能客服等需要自主决策的领域。开发者可通过预置的模板快速搭建代理原型,并利用项目提供的评估工具进行性能对比和迭代优化。由于采用 Go 语言开发,该工具包在性能和并发处理能力上具有优势,同时通过标准化接口降低了与其他系统集成的难度。项目文档包含详细示例和最佳实践指南,适合希望从零开始构建可控 AI 系统的开发者和研究人员使用。 (A01_文本生成_文本对话 / 大语言对话模型及数据)
- awesome-llm-tools - adk-go - agent orchestration, tool use, Gemini/Vertex AI integration | Google ADK Go agents | (2. Libraries & Frameworks / Go)
- awesome-ai-agents - google/adk-go - An open-source Go toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility, modularity, and cloud-native support. (Agent Integration & Deployment Tools / AI Agent Development)
- awesome-agent-frameworks - Google ADK Go - go?style=social) - Google ADK Go is the Go-language member of the Google Agent Development Kit family, extending the same agent abstractions to Go developers. (Agent SDK / framework)
README
# Agent Development Kit (ADK) for Go v 2.0
[](LICENSE)
## Breaking changes
### `session.NewEvent` now requires a `context.Context`
`session.NewEvent` takes a `context.Context` as its first argument:
```go
func NewEvent(ctx context.Context, invocationID string) *Event
```
The event ID and timestamp are now obtained through the `platform` package, so a
time or UUID provider installed on `ctx` (see `platform.WithTimeProvider` and
`platform.WithUUIDProvider`) controls them. This lets callers such as workflow
engines produce deterministic, replay-safe events.
The previous parameterless-context form and the temporary `NewEventWithContext`
helper are gone. Migrate by passing the context that is already in scope:
```go
// Before
ev := session.NewEvent(ctx.InvocationID())
// or
ev := session.NewEventWithContext(ctx, ctx.InvocationID())
// After
ev := session.NewEvent(ctx, ctx.InvocationID())
```
Any `context.Context` works as the first argument: the `ctx` of an agent/tool/
callback (which embed `context.Context`), the incoming RPC/HTTP request context,
or — in tests — `t.Context()`. As the [`context`
package](https://pkg.go.dev/context) advises, thread the context down the call
chain rather than creating one with `context.Background()` in the middle of it;
reserve `context.Background()` for `main`, `init`, and top-level test/setup code.
If you call `NewEvent` from a helper that does not yet receive a context, add a
`ctx context.Context` parameter to that helper and pass it through from its
callers.
### Mocks update required for unified contexts
PR https://github.com/google/adk-go/pull/945 merges ToolContext and CallbackContext into single Context.
This introduces a problem for mock contexts - new functions (ToolContext-related) are missing if the mock was created for the previous version of CallbackContext.
Solution:
Add those functions to your mock:
```go
func (m *MockCallbackContext) Actions() *session.EventActions { return nil }
func (m *MockCallbackContext) FunctionCallID() string { return "" }
func (m *MockCallbackContext) ToolConfirmation() *toolconfirmation.ToolConfirmation { return nil }
func (m *MockCallbackContext) RequestConfirmation(hint string, payload any) error {
return fmt.Errorf("RequestConfirmation() is not supported for MockCallbackContext")
}
func (m *MockCallbackContext) SearchMemory(ctx context.Context, query string) (*memory.SearchResponse, error) {
return nil, fmt.Errorf("SearchMemory() is not supported for MockCallbackContext")
}
var _ agent.Context = (*MockCallbackContext)(nil)
```
#### Alternative: embed `agent.StrictContextMock`
Adding each missing method by hand is reactive: every time the context surface
grows, your mocks break again and you have to patch them. Instead, you can embed
`agent.StrictContextMock` in your test fake and override only the methods your
test actually uses. Because it implements the whole unified context surface,
embedders keep compiling as the interface grows — no further edits needed when
methods are added.
Un-overridden methods panic with "not implemented", so an unexpected call fails
the test loudly instead of silently returning a zero value. The standard
`context.Context` methods (`Deadline`, `Done`, `Err`, `Value`) read from the
supplied `Ctx` rather than panicking.
Assert against the unified `agent.Context` directly.
```go
// Embed StrictContextMock and override only what the test needs.
type fakeContext struct {
agent.StrictContextMock
}
var _ agent.Context = (*fakeContext)(nil)
func TestSomething(t *testing.T) {
cc := &fakeContext{agent.StrictContextMock{Ctx: context.Background()}}
// Override methods as needed, e.g. by adding them on fakeContext.
// ...
}
```