* Extend the compaction summarizer section to Kotlin
The Define a Summarizer group showed Python, Java and TypeScript but not
Kotlin, and two lines of surrounding prose understated Kotlin as a
result: one attributed LlmEventSummarizer to Python and Java only, the
other said only Python and Java can customize the prompt template.
Kotlin has had LlmEventSummarizer since v0.3.0 and exposes
promptTemplate as a constructor parameter.
This is partial coverage rather than an untouched page - the page is
already Kotlin-badged and has a Kotlin tab for the token-threshold
config. That tab is inline, as are all four siblings in this group, so
the new tab is inline too rather than the new .kt file the backlog
suggested; mixing forms between two Kotlin tabs on one page would be
worse than either choice on its own.
* Correct the Java summarizer property name to promptTemplate
adk-java's LlmEventSummarizer exposes promptTemplate, not prompt_template;
only Python uses the snake_case name.
---------
Co-authored-by: Shahin Saadati <3443249+happyhuman@users.noreply.github.com>
* Document how to check whether the context cache was used
The caching page explained how to turn caching on and never how to tell whether
it is working. CacheMetadata has been available since adk-kotlin 0.6.0 and is
undocumented: adk-python has fourteen code references to cache_metadata, while
adk-docs mentions it twice, both incidental -- a BigQuery schema table and a
bullet in the Live dev guide.
The snippet reads it from Event.cacheMetadata and covers both states the type
can be in, because the constructor enforces the split: cacheName, expireTime and
invocationsUsed must either all be set (an active cache) or all be null (the
fingerprint-only state used for prefix matching before a cache exists).
Notes that token counts live on LlmResponse.usageMetadata rather than here,
which the KDoc calls out to avoid duplication and a reader would otherwise
reasonably look for on CacheMetadata.
Badged Kotlin v0.6.0 and verified rather than assumed: the snippet compiles
against a temporary 0.6.0 pin as well as the current 0.7.0 one.
Transcluded and registered, so CI compiles and lints it. Exercised all four
paths with synthetic events: no metadata, fingerprint-only, active, and active
with expireSoon true.
* Correct when CacheMetadata is present on an event
The section claimed every event backed by an LLM response carries a
CacheMetadata. It does not: LlmResponse.cacheMetadata is null when caching
is disabled and also when the call produced no cache information, so the
claim was wrong even with caching on.
Say "can carry", name both null cases, and explain why the snippet checks
before reading. The snippet's own comment made the same overstatement.
* docs: clarify the behavior of expireSoon and cache status in documentation and snippets
* Document createHttpOptions on the Kotlin context cache config
ContextCacheConfig gained a fourth parameter, createHttpOptions, in adk-kotlin
0.7.0. It bounds the CachedContent.create() call specifically, and is fail-open:
when the create exceeds the timeout it fails and the request proceeds uncached,
so it is a latency guard rather than a correctness switch. The snippet says so,
since that is the part the signature does not convey.
No other language documents this. Python and Java have no equivalent parameter
at all -- the Java record has exactly three components -- so this is Kotlin-first
rather than a backfill.
HttpOptions is ADK's own com.google.adk.kt.types.HttpOptions, deliberately not
the backend SDK's, so the import matters: two other types share the name.
Extracted, compiled and ran the snippet against the 0.7.0 pin: OK timeout=10s.
* docs: add create_http_options parameter documentation for cache configuration
* Add Kotlin snippet for token-threshold context compaction
The compaction page had no Kotlin at all. EventsCompactionConfig gained
tokenThreshold and eventRetentionSize in adk-kotlin 0.6.0, so the Kotlin tab
shows that pair, matching the TypeScript tab's strategy.
Kotlin sits across the two groupings the prose already draws: the config
attaches to App, as in Python and Java, but supports the token-threshold pair
like TypeScript. Both parentheticals are updated to say so rather than adding
new prose.
The snippet notes that tokenThreshold and eventRetentionSize must be set
together. That is a runtime require, not a compile error, so it is easy to hit:
setting one alone throws "tokenThreshold and eventRetentionSize must be set
together or both null". The same rule applies to compactionInterval and
overlapSize, which Kotlin also supports.
Badged Kotlin v0.7.0 rather than 0.6.0, when the fields landed: appName is
"my-agent" to match the sibling tabs, and hyphens in app names were only
allowed from 0.7.0.
Inline to match the page's other tabs, so CI will not compile it. Extracted,
compiled and ran it against the 0.7.0 pin in a throwaway project:
OK app=my-agent tokenThreshold=1000 retention=1 paired=true.
* Note that Kotlin also supports the sliding-window pair
Self-review finding. The Kotlin tab shows tokenThreshold/eventRetentionSize
while Python and Java show compactionInterval/overlapSize, so a reader
comparing tabs could conclude the strategy is fixed per language. It is not:
EventsCompactionConfig accepts either pair, and exposes hasTokenThresholdConfig
and hasSlidingWindowConfig for each.
* Add Kotlin snippet for VertexAiSessionService
The VertexAiSessionService section showed Python, Go and Java. Kotlin gained
the service in adk-kotlin 0.7.0, so add a Kotlin tab and Kotlin to that
section's language-support badge.
Kotlin addresses the reasoning engine differently from every sibling tab on
the page, so the snippet says so at the point of use:
- The engine is fixed at construction via `reasoningEngineId`. The 0.7.0 KDoc
is explicit that, unlike the Python and Java ADK, `SessionKey.appName` is
never parsed to derive the engine -- it is only a label. The Python tab
above passes the engine through `app_name` on each call.
- `reasoningEngineId` must be the bare numeric id. The constructor rejects a
full resource name outright (`require(reasoningEngineId.all { it.isDigit() })`),
while the Python tab passes
`projects/.../locations/.../reasoningEngines/...`.
A reader copying the adjacent Python idiom would therefore fail twice over.
Written inline to match the two existing Kotlin tabs on this page. Inline
snippets never reach Gradle, so this one was additionally compiled against the
0.7.0 pin in a scratch file that is not part of the commit.
* Address review: JVM-only note, wire the service to a Runner
Five fixes from self-review against the 0.7.0 sources and upstream's own
VertexAiSessionServiceExample.kt, which I should have consulted before writing
the first version:
- State that the service is JVM-only. It lives in core/src/jvmMain, so it does
not exist on Android. Kotlin is the only language on this page where that
distinction applies, so if the Kotlin tab omits it, nothing carries it.
- Show the service actually being used. The snippet stopped at an uncalled
`suspend fun`; it now hands the service to an InMemoryRunner, which is what
the section is about and what the upstream example does.
- Use `runBlocking` in a `main`, matching upstream, instead of a suspend
function nothing calls.
- Drop `state = mapOf(...)`. It defaults to null, upstream omits it, and the
Java tab explicitly notes no initial state is needed, so it introduced a
concept the sibling tabs deliberately avoid.
- Widen the comparison from "the Python and Java tabs" to all the other tabs.
The KDoc phrasing names Python and Java, but this page also has a Go tab.
The added LlmAgent needs an explicit `model`; the first draft would not have
compiled without it, which the scratch compile caught.
* Trim the snippet back to parity with the sibling tabs
The previous revision added an LlmAgent, a Gemini model and an InMemoryRunner,
taking the tab to 30 code lines against Python's 5, Go's 8 and Java's 12. No
sibling tab on this page constructs a runner or an agent, and this section's
prose never mentions one -- it is a characteristics list, not a wiring guide.
That change came from misapplying a review finding. On sessions/memory the
equivalent note was right: the prose there says "instantiating the
VertexAiMemoryBankService and passing it to the Runner" and the Python tab
shows exactly that. Neither holds here, so the runner was answering a question
this page does not ask.
Now scoped like the Java tab, the closest analogue: construct the service, then
create one session. That is still enough to demonstrate both divergences -- the
engine pinned at construction as a bare numeric id, and appName being only a
label -- since showing the second requires a SessionKey.
`runBlocking` stays, because createSession is a suspend function; it is the
direct counterpart of the Java tab's `.blockingGet()`, and the comment now says
so. Recompiled against the 0.7.0 pin in a scratch file.
* docs: update experimental annotation placement and refine context caching documentation note
* Add Kotlin snippet for context caching configuration
The context caching page showed Python and Java only. `ContextCacheConfig` and
the `App`-level wiring are available in adk-kotlin as of 0.7.0, so add a Kotlin
tab and advertise Kotlin support in the page badge.
The snippet is inline rather than transcluded to match the Python and Java tabs
on this page. It opts in at file level via `ExperimentalContextCachingFeature`,
which the API still requires, and uses `kotlin.time` durations so the TTL reads
as `10.minutes` rather than a `Duration.ofMinutes` call.
* Fix broken links to adk-python plugin samples
The three plugin sample links 404. adk-python renamed
`contributing/samples/plugin/` to `contributing/samples/plugins/`; the
directory contents are otherwise unchanged, so only the path segment moves.
This is what the repo-wide `link-check` job has been failing on. It is
unrelated to the 0.7.0 upgrade in this PR, but the check gates the merge and
the fix is confined to the three URLs.
Verified all three targets return 200.
* Use a minTokens value that actually has an effect
The snippet carried Python's `minTokens = 2048`. The 0.7.0 KDoc is explicit
that "Gemini enforces a hard 4096-token minimum that always applies, so values
below 4096 have no additional effect" -- so as written the line was inert and
the comment implied otherwise. Use a value above the floor and say where the
floor comes from.
* docs: update ADK Go imports to v2 for core concepts and tutorials
* docs: update ADK Go imports and APIs to v2 for runtime and safety
* docs: update ADK Go imports to v2 for features (workflows, tools, skills, sessions, plugins)
* docs: update ADK Go imports to v2 for operations and integrations
---------
Co-authored-by: Kristopher Overholt <koverholt@google.com>
* UpdateContext.md
* Update index.md
* Update index.md
noticed that the hierarchy of bullet points was not correct
* Update context and callbackcontext.md
* Update compaction.md
Added the explanation for token compaction, and a header section for sliding window section, added the section: What is compaction?
* Update compaction.md
Worked on changes
* Update compaction.md
* Update compaction.md
worked on other 2 comments
* Update compaction.md
* docs: home page
* updates based on feedback
* respond to review feedback
* docs: update gemini selector strings to "flash-latest"
* Update homepage.css
* Replace google.github.io/adk-docs URLs and /adk-docs/ paths with adk.dev
Migrate all hardcoded documentation references to use the new custom
domain. Update root-relative links to remove the /adk-docs/ subpath
prefix since the site will be served from the root of adk.dev.
* Additional fixes
* Corrected the python and java snippets and removed the "Pseudocode" labels from them.
* Added the 3 missing java snippets.
* Update index.md
---------
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
* Update snippets to new Context type
* Updating documentation to reflect the unified Context type in Typescript
* Incorporating review feedback
---------
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
* Deleted redundant files.
* Deleted redundant files.
* Deleted redundant files.
* Deleted redundant files.
* Deleted redundant files.
* Deleted redundant files.
* Delete .gitignore
Deleted redundant files.
* Delete .gitignore
Deleted redundant files.
* Delete .gitignore
* Delete .gitignore
* Delete .gitignore
* Revert changes to .gitignore
* Revert changes to .gitignore
* Revert changes to .gitignore
* Revert changes to .gitignore
* Revert changes to .gitignore
* Revert changes to .gitignore
* Add MCP Tools TS example
* Removed unnecessary changes
* Removed extra slashes
* Added the custom agent sample.
* Corrected an error in the package.json file.
* Updated custom-agent.md
* Made small fixes.
* Add Session TS examples
* Added the typescript code snippets for multi agent.
* added the code sample for loop agent
* Added the code sample for loop agent
* Added the code sample for parallel agent
* Fixed a few issues and bugs
* Added the code sample for sequential agent
* Renamed run back to runAsync
* Updated the capital agent code sample.
* Corrected the snippet
* Renamed run() to runAsync()
* Add Runtime TS examples
* Fixed the snippets after library updates.
* Fixed the sample code after library changes.
* Added final touchups and fixes.
* Updated the code based on recent library changes.
* Updated package.json
* Updated package.json
* Updated package.json
* Updated the code with runAsync and package.json
* Updated the typescript sample.
* Updated after_tool_callback.ts with runAsync
* Updated after_model_callback.ts
* Updated before_model_callback.ts
* Updated before_tool_callback.ts
* Created before_agent_callback.ts
* Update before_agent_callback.ts
Changed the condition
* Update before_model_callback.ts
Changed the condition
* Update after_model_callback.ts
Changed the condition
* Update after_tool_callback.ts
Changed the condition
* Update after_agent_callback.ts
Changed the condition
* Update callback_basic.ts
Changed the condition
* Update storyflow_agent.ts
Changed the condition
* Update sequential_agent_code_development_agent.ts
Changed the condition
* Updated before_agent_callback.ts
* Removed unnecessary comment.
* Updated comment
* Renamed run to runAsync
* Added artifact code snippets.
* Fixed .link-checker-config.json
* Added tsconfig.json
* Update .gitignore with node modules files
* Added 7 typescript code snippets
* Cleaned up and corrected the snippets for plugins
* Update index.md
Undid the changes in artifacts/index.md
* Escaped properly.
* Add Long Running Function Tool TS examples
* Resolved code review feedback
* Fixed the code sample per git comments.
* Fixed the code per git comments.
* Fixed the md file per git comments.
* Fixed the issues per git comments.
* Fixed issues per github comments.
* Fixed the issues per PR comments.
* Fixed issues per PR comments.
* Added a code sample for HITL
* Fixed the indentations in the typescript code
* Used createPartFromBase64 when appropriate.
* Switched to use createUserContent.
* docs: Add JavaScript Quickstart, short unified format
* Added a simulated user delay to the code sample.
* Made some cosmetic improvements
* Added the code snippet with HITL with policy
* Made cosmetic modifications to multi-agents.md
* Added more tutorial for the HITL with policy
* Modularized the main function and added helper functions.
* Resolved code review feedback
* Resolved code review feedback
* Resolved code review feedback
* Fixed minor things in the typescript code per PR comments.
* Fixed the import for Event and used createEventActions.
* Simplified functionResponse code.
* Corrected the Event import and used createEventActions.
* Updated ADK versions in package.json.
* Final review of all changes & Add Safety TS example
* Make tsconfig.json files consistent
* Generated the API Reference for typescript
* Resolved code review feedback
* feat: Add Typescript API reference to docs
This commit adds the generated TypeDoc documentation for the Typescript ADK to the documentation site.
It also updates the main API reference page to include a link to the new Typescript API reference.
* docs: update TypeScript quickstart
* docs: Add version tags for Build Agents topics
- add version tags
- move TS content to second position (after Python)
* docs: Add MCP Toolbox for databases TS SDK Documentation
* Update mcp-toolbox-for-databases.md
* use typescript code block
* minor changes
* Update mcp-toolbox-for-databases.md
* Auto generated the typescript API reference.
* Added the TS code snippets for context.
* Fixed TS code snippets for context.
* Modified the sample based on the comment.
* docs: adding TypeScript language tags (2 of 3)
- Update all Run Agents section topics
- change all TS tags to v0.2.0 per eng agreement
* docs: Add TypeScript language support tags, Components (3 of 3)
- add TS language support tags
- re-order TS examples to be second
- minor fixes: remove trailing spaces
* Added callback samples for typescript to the markdown files.
* Updated adk version in quickstart
* Updated google/adk version for typescript.
---------
Co-authored-by: manchan <manchan@google.com>
Co-authored-by: Mandy Chan <75594070+slothwriter@users.noreply.github.com>
Co-authored-by: Joe Fernandez <joefernandez@google.com>
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
Co-authored-by: Twisha Bansal <58483338+twishabansal@users.noreply.github.com>
* Rename 'compactor' to 'summarizer' in documentation
Updated documentation to replace 'compactor' with 'summarizer' and adjusted references accordingly.
* Formatting
---------
Co-authored-by: Kristopher Overholt <koverholt@google.com>
I have rewritten the documentation to replace the outdated `SlidingWindowCompactor` with the correct `LlmEventSummarizer`, and I've updated the code example and explanatory text to match.
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
* docs: Add Go language quickstart
* updates based on review comments
* fix tab stops
* update based on review comments
* sync with main
* update to tested version
* Added google_search snippet
* Fix: Address Go style guide issues in google_search.go
* Migrated to new API
* Fixed tool info in md file
* Added partial check
* Added function-tools sample
* Migrated to new API
* Added partial check
* Ran linter
* feat: add go fmt check
* Run go fmt only on changed files
* Added google_search snippet
* Fix: Address Go style guide issues in google_search.go
* Migrated to new API
* Added partial check
* Added function-tools sample
* Migrated to new API
* Added partial check
* Ran linter
* feat: add go fmt check
* Run go fmt only on changed files
* Feat: Add Golang example for LLM agents
* Added schema agent
* Added session support
* Migrated to new API
* Added back OutputKey
* Added missing snippets
* Moved snipped to its own package
* Minor cleanup
* Reverted llm-agents.md
* Added back correct changes to llm-agents.md
* Updated to newest API
* Ran linter
* WIP
* WIP: Added the rest of the agents
* Added sequential agent
* Migrated agents to new API
* Fixed snippet tags
* Updated parallel and sequential with OutputKey
* Updated loop agent
* Cleanup
* Fixed and ran linter
* Removed comment
* Ran linter
* Added custom agent snippets
* Migrated to new API
* Fixed incorrect info about channels since run returns an Iterator, not Channel
* Cleanup and renaming
* Ran linter
* Fixed md
* Added multi-agent docs
* Updated to use AgentTool
* Split snippets
* Added missing file
* Ran linter and fixed API
* Added Models snippets
* Migrated to new API
* Embedded imports
* Ran linter
* Added long running tool
* Ran linter and fixed API
* Switched to two-turn style
* Ran linter
* Added callback snippets
* Added back imports
* Added types of callbacks snippets
* feat(go): align callback snippets with other languages
* Ran linter and updated API
* Added tool callbacks
* Added artifact snippets
* Use story.pdf instead of random bytes
* Fixed issue with artifact loading
* Cleanup unneeded fixes
* Added back inadvertently removed GCS section
* Addressed PR comments
* Ran linter
* feat: Added context snippets
* Fixed callback signature
* Fixed additional callbacks
* Added remaining snippets
* Added conceptual runner example
* Removed duplicate code
* Clean up tags and imports
* Updated API
* Twaked text
* Ran linter
* Fixed broken API issues
* Updated to latest Go ADK API
* Added func param info
* Interleaved Py and Go
* Revert mistakes
* Removed extra newline
* Added example cloud run code and update md with Go (#41)
* Added example cloud run code and update md with Go
* Added a2a_agent_url and fixed future tense
* Moved Go before Java
---------
Co-authored-by: ivanmkc <ivanmkc@google.com>
* adding go snippets to runconfig docs
* realigning runconfig go examples with current state of adk-go.
* adding language support tags to individual runtime config fields
* removing unsupported supportcfc go examples
* removing unsupported streamingmode.bidi go snippets
* Added AgentTool examples (#31)
* Added AgentTool example
* Ran formatter
---------
Co-authored-by: ivanmkc <ivanmkc@google.com>
* adding initial go sessions.sessions snippets
* updating go session docs + session examples
* update go session snippets
* updating DatabaseSessionService language support tag
* cleaning up go vertex ai comments
* removing go.mod for session_management_example
* docs: add language support tags for Go
* initial go runtime sample updates
* fixing runtime go snippet formatting
* formatting updates to runtime go snippets
* updating runtime go examples to streamline to newer go features
* adding go snippets for events
* updating go snippets for events
* adding artifactdelta snippet for go
* minor java fixes, cleaning up go event.content
* Custom tools: Merging again (#44)
* Added missing custom-tools snippets
* Split user_preference runner code
* Split more files
* Tweaks
* Split session into 1 and 2 and added artifact saving
* Fixed conflict
---------
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Fixed tab issue with cloud-run md (#45)
Co-authored-by: ivanmkc <ivanmkc@google.com>
* adding initial go snippets for memory services
* updating go memory sample, adding python formatting in docs to clarify current support.
* removing go replace for memory example
* removing go.sum from memory_example
* fixing go formatting for memory example
* fixing go memory snippets to streamline examples in docs
* removing unnecessary go.mod for memory_example.go and snippet cleanup
* adding go session state snippets."
* adding additional go state examples for state injection
* fixing go formatting
* fixing language ordering on session/state.md; removing unnecessary go.mod files
* reworking error functions in go session state samples
* fixing go formatting on session state samples
* initial go snippets for safety tools
* fixing go snippet formatting in safety/index.md
* temp storing safety example
* cleaning up go snippets in safety docs; deferring safety go full example
* cleaning up go safety snippets
* Added link to Go API docs (#47)
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Added a2a_basic sample (#46)
* Added a2a_basic sample
* Removed dummy LLMs
* Added md
Fix inaccuracies in md
Ran formatter
* Cleaned up index
---------
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Reverted to proper ToC and added missing links (#48)
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Added missing get-started/go.md (#50)
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Added missing JSON tags for Go structs (#51)
* Added json tags
* Added jsonschema and json tags
---------
Co-authored-by: ivanmkc <ivanmkc@google.com>
* Renamed Golang to Go (#52)
Co-authored-by: ivanmkc <ivanmkc@google.com>
---------
Co-authored-by: Joe Fernandez <joefernandez@google.com>
Co-authored-by: ivanmkc <ivanmkc@google.com>
Co-authored-by: Toni Klopfenstein <tklopfenstein@google.com>
* docs: add language support tags to pages
- replace img.shield tags
- add language support tags where missing
* update Agents page with general tags
* update language and version tagging
- response to review comments
- rename css styles to avoid style name conflicts
* add tags to api-server page
* docs: Update formatting of logging information
- Remove duplicates
* Fix formatting/spelling issues in Express Mode page
* Fix code formatting
* Rename "Google Cloud's" -> Google Cloud per branding guidelines
* Spelling fix on A2A
* Formatting fixes in a2a consuming
* Fix typo/formatting error on API Reference homepage
* Remove custom anchors in CONTRIBUTING.md because GFM doesn't support them
* Add imports to A2A Samples and update agent.json to agent-card.json
---------
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
This commit clarifies the behavior of the `temp:` namespace in the documentation.
The following changes were made:
- Updated `docs/sessions/state.md` to provide a more detailed explanation of the `temp:` namespace.
- Updated `docs/context/index.md` to improve the clarity of an example related to passing data between tools.
- Updated `docs/runtime/index.md` to add a note about the scope of `temp:` variables.
- Updated `docs/agents/multi-agents.md` and `docs/agents/workflow-agents/sequential-agents.md` to clarify how the `temp:` namespace is propagated to sub-agents.
- Updated `docs/tools/function-tools.md` to explain how to use the `temp:` namespace to pass data between tool calls.
fixes#160
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>