{"id":33319556,"url":"https://github.com/google/adk-go","last_synced_at":"2026-07-28T00:00:53.459Z","repository":{"id":322688661,"uuid":"978236277","full_name":"google/adk-go","owner":"google","description":"An open-source, code-first Go toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.","archived":false,"fork":false,"pushed_at":"2026-07-27T15:25:07.000Z","size":29975,"stargazers_count":8540,"open_issues_count":289,"forks_count":855,"subscribers_count":95,"default_branch":"main","last_synced_at":"2026-07-27T17:08:57.630Z","etag":null,"topics":["a2a","agents","agents-sdk","ai","aiagentframework","gemini","genai","go","llm","mcp","multi-agent-collaboration","multi-agent-systems","sdk","vertex-ai"],"latest_commit_sha":null,"homepage":"https://google.github.io/adk-docs/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README-v2.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-05-05T17:16:26.000Z","updated_at":"2026-07-27T16:06:57.000Z","dependencies_parsed_at":"2025-11-20T19:00:39.163Z","dependency_job_id":"5e4e8a31-5994-4ea0-bf40-b4c07bbd724a","html_url":"https://github.com/google/adk-go","commit_stats":null,"previous_names":["google/adk-go"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/google/adk-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fadk-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fadk-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fadk-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fadk-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/adk-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fadk-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35969566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-27T02:00:06.776Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a2a","agents","agents-sdk","ai","aiagentframework","gemini","genai","go","llm","mcp","multi-agent-collaboration","multi-agent-systems","sdk","vertex-ai"],"created_at":"2025-11-19T21:00:26.628Z","updated_at":"2026-07-28T00:00:53.449Z","avatar_url":"https://github.com/google.png","language":"Go","funding_links":[],"categories":["⚙️ Implementations \u0026 Libraries","Repos","📚 Projects (1974 total)","Go","A01_文本生成_文本对话","2. Libraries \u0026 Frameworks","Agent Integration \u0026 Deployment Tools","Agent SDK / framework","AI 机器学习"],"sub_categories":["Tools \u0026 Libraries","大语言对话模型及数据","Go","AI Agent Development"],"readme":"# Agent Development Kit (ADK) for Go v 2.0\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n\n## Breaking changes\n\n### `session.NewEvent` now requires a `context.Context`\n\n`session.NewEvent` takes a `context.Context` as its first argument:\n\n```go\nfunc NewEvent(ctx context.Context, invocationID string) *Event\n```\n\nThe event ID and timestamp are now obtained through the `platform` package, so a\ntime or UUID provider installed on `ctx` (see `platform.WithTimeProvider` and\n`platform.WithUUIDProvider`) controls them. This lets callers such as workflow\nengines produce deterministic, replay-safe events.\n\nThe previous parameterless-context form and the temporary `NewEventWithContext`\nhelper are gone. Migrate by passing the context that is already in scope:\n\n```go\n// Before\nev := session.NewEvent(ctx.InvocationID())\n// or\nev := session.NewEventWithContext(ctx, ctx.InvocationID())\n\n// After\nev := session.NewEvent(ctx, ctx.InvocationID())\n```\n\nAny `context.Context` works as the first argument: the `ctx` of an agent/tool/\ncallback (which embed `context.Context`), the incoming RPC/HTTP request context,\nor — in tests — `t.Context()`. As the [`context`\npackage](https://pkg.go.dev/context) advises, thread the context down the call\nchain rather than creating one with `context.Background()` in the middle of it;\nreserve `context.Background()` for `main`, `init`, and top-level test/setup code.\n\nIf you call `NewEvent` from a helper that does not yet receive a context, add a\n`ctx context.Context` parameter to that helper and pass it through from its\ncallers.\n\n### Mocks update required for unified contexts \nPR https://github.com/google/adk-go/pull/945 merges ToolContext and CallbackContext into single Context.\n\nThis introduces a problem for mock contexts - new functions (ToolContext-related) are missing if the mock was created for the previous version of CallbackContext. \nSolution:\nAdd those functions to your mock:\n```go\nfunc (m *MockCallbackContext) Actions() *session.EventActions                       { return nil }\nfunc (m *MockCallbackContext) FunctionCallID() string                               { return \"\" }\nfunc (m *MockCallbackContext) ToolConfirmation() *toolconfirmation.ToolConfirmation { return nil }\nfunc (m *MockCallbackContext) RequestConfirmation(hint string, payload any) error {\n\treturn fmt.Errorf(\"RequestConfirmation() is not supported for MockCallbackContext\")\n}\nfunc (m *MockCallbackContext) SearchMemory(ctx context.Context, query string) (*memory.SearchResponse, error) {\n\treturn nil, fmt.Errorf(\"SearchMemory() is not supported for MockCallbackContext\")\n}\n\nvar _ agent.Context = (*MockCallbackContext)(nil)\n```\n\n#### Alternative: embed `agent.StrictContextMock`\n\nAdding each missing method by hand is reactive: every time the context surface\ngrows, your mocks break again and you have to patch them. Instead, you can embed\n`agent.StrictContextMock` in your test fake and override only the methods your\ntest actually uses. Because it implements the whole unified context surface,\nembedders keep compiling as the interface grows — no further edits needed when\nmethods are added.\n\nUn-overridden methods panic with \"not implemented\", so an unexpected call fails\nthe test loudly instead of silently returning a zero value. The standard\n`context.Context` methods (`Deadline`, `Done`, `Err`, `Value`) read from the\nsupplied `Ctx` rather than panicking.\n\nAssert against the unified `agent.Context` directly.\n\n```go\n// Embed StrictContextMock and override only what the test needs.\ntype fakeContext struct {\n\tagent.StrictContextMock\n}\n\nvar _ agent.Context = (*fakeContext)(nil)\n\nfunc TestSomething(t *testing.T) {\n\tcc := \u0026fakeContext{agent.StrictContextMock{Ctx: context.Background()}}\n\t// Override methods as needed, e.g. by adding them on fakeContext.\n\t// ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fadk-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fadk-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fadk-go/lists"}