dex-agents-google-adk-cli 0.6.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ # Copyright (c) 2026 Super Durable, Inc.
2
+ #
3
+ # Licensed under the Sustainable Use License 1.0.
4
+ # You may not use this file except in compliance with the License.
5
+ # See the LICENSE file in the repository root.
6
+ #
7
+ # SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
+
9
+ """The ``dex-agents-google-adk`` command: a Google ADK agent in the terminal.
10
+
11
+ It builds the agent session Flow with the Google ADK adapter and
12
+ runs it with the shared Dex Agents CLI core. See the package README.
13
+ """
14
+
15
+ import dex_agents_cli_core # noqa: F401 # first: it configures gRPC before anything imports it
16
+
17
+ # isort: split
18
+
19
+ import sys
20
+
21
+ from dex_agents_cli_core import ConfigError, command_name, run_agent_cli
22
+ from dex_agents_google_adk_cli.harness import (
23
+ DEFAULT_GOOGLE_ADK_MODEL,
24
+ DEFAULT_INSTRUCTIONS,
25
+ GOOGLE_ADK_CLI_FLOW_TYPE,
26
+ GoogleAdkHarness,
27
+ validate_google_adk_section,
28
+ )
29
+
30
+ __all__ = [
31
+ "DEFAULT_GOOGLE_ADK_MODEL",
32
+ "DEFAULT_INSTRUCTIONS",
33
+ "GOOGLE_ADK_CLI_FLOW_TYPE",
34
+ "GoogleAdkHarness",
35
+ "main",
36
+ "run",
37
+ "validate_google_adk_section",
38
+ ]
39
+
40
+
41
+ def main(argv: list[str] | None = None) -> int:
42
+ """Run the command and return its exit code.
43
+
44
+ Args:
45
+ argv: The arguments without the program name; ``None`` reads ``sys.argv``.
46
+
47
+ Returns:
48
+ 0 on success, 1 for a failure at run time, and 2 for a usage or
49
+ configuration error, such as a key in the ``google_adk`` section.
50
+ """
51
+ harness = GoogleAdkHarness()
52
+ try:
53
+ return run_agent_cli(harness, argv)
54
+ except ConfigError as error:
55
+ print(f"{command_name(harness)}: {error}", file=sys.stderr)
56
+ return 2
57
+
58
+
59
+ def run() -> None:
60
+ """Run the command from its console script and exit with its code."""
61
+ raise SystemExit(main())
@@ -0,0 +1,14 @@
1
+ # Copyright (c) 2026 Super Durable, Inc.
2
+ #
3
+ # Licensed under the Sustainable Use License 1.0.
4
+ # You may not use this file except in compliance with the License.
5
+ # See the LICENSE file in the repository root.
6
+ #
7
+ # SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
+
9
+ """``python -m dex_agents_google_adk_cli`` runs the ``dex-agents-google-adk`` command."""
10
+
11
+ from dex_agents_google_adk_cli import run
12
+
13
+ if __name__ == "__main__":
14
+ run()
@@ -0,0 +1,119 @@
1
+ # Copyright (c) 2026 Super Durable, Inc.
2
+ #
3
+ # Licensed under the Sustainable Use License 1.0.
4
+ # You may not use this file except in compliance with the License.
5
+ # See the LICENSE file in the repository root.
6
+ #
7
+ # SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
+
9
+ """The Google ADK harness: an ADK ``LlmAgent`` on Gemini with the CLI core's tools."""
10
+
11
+ from __future__ import annotations
12
+
13
+ from collections.abc import Mapping
14
+ from typing import Any
15
+
16
+ import dex_agents_cli_core # noqa: F401 # first: it configures gRPC before anything imports it
17
+
18
+ # isort: split
19
+
20
+ from google.adk.agents import LlmAgent
21
+ from google.adk.agents.callback_context import CallbackContext
22
+ from google.adk.agents.readonly_context import ReadonlyContext
23
+ from google.adk.models.google_llm import Gemini
24
+ from google.adk.models.llm_request import LlmRequest
25
+ from google.adk.models.llm_response import LlmResponse
26
+
27
+ from dex_agents import AgentSessionFlow
28
+ from dex_agents_cli_core import ConfigError, HarnessContext, LocalToolGroup
29
+ from dex_agents_google_adk import adk_agent_session_flow
30
+
31
+ #: The Flow type of the command's sessions, before the CLI core namespaces it.
32
+ GOOGLE_ADK_CLI_FLOW_TYPE = "DexAgentsGoogleAdkCliSession"
33
+
34
+ #: The Gemini model the command uses when the configuration file sets none.
35
+ DEFAULT_GOOGLE_ADK_MODEL = "gemini-2.5-flash"
36
+
37
+ #: The instructions the agent gets when the configuration sets none.
38
+ DEFAULT_INSTRUCTIONS = (
39
+ "You are a helpful assistant. Use your tools to work with the files and commands "
40
+ "in your workspace and with the connected services."
41
+ )
42
+
43
+
44
+ class GoogleAdkHarness:
45
+ """The ``dex-agents-google-adk`` command: a Google ADK agent in the terminal.
46
+
47
+ The agent is one ADK ``LlmAgent`` on the Gemini API. Each model call
48
+ sends the running turn's model and instructions, so session settings
49
+ that change them apply from the next turn. The CLI core's connector and
50
+ local tools are the agent's only tools.
51
+
52
+ The command declares no reasoning effort values, because Gemini models
53
+ set thinking differently by generation: Gemini 3 takes a thinking level
54
+ and Gemini 2.5 a thinking token budget. A ``reasoning_effort`` session
55
+ setting fails the turn with ``unsupported_reasoning_effort``.
56
+ ``suggested_models`` lists Gemini models for the terminal UI's ``/model``.
57
+
58
+ .. versionchanged:: 0.6.2
59
+ The suggested models.
60
+ """
61
+
62
+ name = "google-adk"
63
+ config_section = "google_adk"
64
+ flow_type = GOOGLE_ADK_CLI_FLOW_TYPE
65
+ default_model: str | None = DEFAULT_GOOGLE_ADK_MODEL
66
+ replaced_local_tools: frozenset[LocalToolGroup] = frozenset()
67
+ suggested_models = ("gemini-2.5-flash", "gemini-2.5-pro")
68
+
69
+ def create_session_flow(self, context: HarnessContext) -> AgentSessionFlow:
70
+ """Build the ADK agent session Flow from the effective configuration.
71
+
72
+ Args:
73
+ context: The configuration, workspace, and tool sources.
74
+
75
+ Returns:
76
+ The Flow, with ``context.flow_type`` as its type.
77
+
78
+ Raises:
79
+ ConfigError: If the ``google_adk`` section has a key; it has no options yet.
80
+ """
81
+ validate_google_adk_section(context.harness_options)
82
+
83
+ def instructions(readonly_context: ReadonlyContext) -> str:
84
+ return context.current_turn().instructions or DEFAULT_INSTRUCTIONS
85
+
86
+ def use_turn_model(
87
+ callback_context: CallbackContext, llm_request: LlmRequest
88
+ ) -> LlmResponse | None:
89
+ # The Gemini model sends the request's model name, so this switches models per turn.
90
+ llm_request.model = context.current_turn().model
91
+ return None
92
+
93
+ agent = LlmAgent(
94
+ name="assistant",
95
+ model=Gemini(model=context.config.model),
96
+ instruction=instructions,
97
+ before_model_callback=use_turn_model,
98
+ )
99
+ return adk_agent_session_flow(
100
+ agent,
101
+ flow_type=context.flow_type,
102
+ tool_sources=context.tool_sources,
103
+ media_store=context.media_store,
104
+ summary_attributes_indexed=context.is_session_summary_indexed,
105
+ )
106
+
107
+
108
+ def validate_google_adk_section(options: Mapping[str, Any]) -> None:
109
+ """Reject every key of the ``google_adk`` section, which has no options yet.
110
+
111
+ Args:
112
+ options: The section, ``{}`` when the file omits it.
113
+
114
+ Raises:
115
+ ConfigError: ``schema`` with the first key's JSON Pointer.
116
+ """
117
+ for key in sorted(options):
118
+ escaped = key.replace("~", "~0").replace("/", "~1")
119
+ raise ConfigError("schema", f"/google_adk/{escaped}", keyword="additionalProperties")
File without changes
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: dex-agents-google-adk-cli
3
+ Version: 0.6.8
4
+ Summary: The dex-agents-google-adk command: a durable Google ADK agent in your terminal
5
+ Author: Super Durable
6
+ License-Expression: LicenseRef-Sustainable-Use-1.0
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Typing :: Typed
12
+ Requires-Dist: dex-agents==0.6.8
13
+ Requires-Dist: dex-agents-cli-core==0.6.8
14
+ Requires-Dist: dex-agents-google-adk==0.6.8
15
+ Requires-Dist: dex-python-sdk==1.45.2
16
+ Requires-Dist: google-adk>=2.13,<3
17
+ Requires-Python: >=3.11
18
+ Project-URL: Homepage, https://github.com/superdurable/dex/tree/main/agents/cli/python/google-adk
19
+ Project-URL: Repository, https://github.com/superdurable/dex
20
+ Project-URL: Changelog, https://github.com/superdurable/dex/blob/main/agents/CHANGELOG.md
21
+ Description-Content-Type: text/markdown
22
+
23
+ # dex-agents-google-adk-cli
24
+
25
+ `dex-agents-google-adk-cli` provides the `dex-agents-google-adk` command. It
26
+ runs a [Google ADK](https://github.com/google/adk-python) agent as a durable
27
+ Dex agent session and chats with it in your terminal. The shared CLI core,
28
+ [`dex-agents-cli-core`](../core/README.md), starts or reuses `dexcli dev`,
29
+ connects the connectors MCP server, and runs the Worker. This package only
30
+ builds the agent with the
31
+ [Google ADK adapter](../../../python/google-adk/README.md).
32
+
33
+ ## Running it
34
+
35
+ The command needs Python 3.11 or later and a Gemini API key:
36
+
37
+ ```bash
38
+ export GOOGLE_API_KEY=...
39
+ uvx --from dex-agents-google-adk-cli dex-agents-google-adk
40
+ ```
41
+
42
+ The Google Gen AI SDK reads the key from `GOOGLE_API_KEY` or
43
+ `GEMINI_API_KEY`. To call Gemini on Vertex AI instead, set
44
+ `GOOGLE_GENAI_USE_VERTEXAI=true`, `GOOGLE_CLOUD_PROJECT`, and
45
+ `GOOGLE_CLOUD_LOCATION`, and sign in with Application Default Credentials.
46
+ The command passes these variables to the SDK and never prints or stores
47
+ them.
48
+
49
+ The first run asks the `init` questions and writes
50
+ `~/.dex/agents/google-adk.yaml`. Then type a message at the `>` prompt.
51
+ Approve or reject tool calls with `y` or `n`, and press Ctrl-D to exit. The
52
+ session stays in Dex, and the command prints the `--resume` line that
53
+ continues it. See the [CLI core README](../core/README.md#running-a-command)
54
+ for every subcommand and option, and [`agents/cli`](../../README.md) for the
55
+ configuration file.
56
+
57
+ ## Configuration
58
+
59
+ The model defaults to `gemini-2.5-flash`; set `model` in the file or pass
60
+ `--model` to change it. It is a Gemini model name. `system_prompt` replaces
61
+ the default instructions. Session settings that change `model` or
62
+ `system_prompt` apply from the session's next turn. The `google_adk` section
63
+ has no options yet, and any key in it is a configuration error.
64
+
65
+ The command has no reasoning effort setting: Gemini 3 models take a thinking
66
+ level and Gemini 2.5 models a thinking token budget. A session whose settings
67
+ carry `reasoning_effort` fails its turn with `unsupported_reasoning_effort`,
68
+ and the terminal UI does not offer `/effort`. Its `/model` also offers
69
+ `gemini-2.5-pro`.
70
+
71
+ ## Tools
72
+
73
+ The agent is one ADK `LlmAgent`. Its tools are the CLI core's connector tools
74
+ and local tools: files, shell commands, web fetch, and the browser. Each
75
+ call runs in its own Dex tool Step with the CLI core's rules: reads run at
76
+ once, writes and shell commands wait for approval unless the shell allow list
77
+ has the command, and file tools stay in the workspace. See the
78
+ [CLI core README](../core/README.md) for the tools and their rules.
79
+
80
+ ## Images
81
+
82
+ `/image <path>` attaches an image file to the next message. The command gives
83
+ the Google ADK adapter the media store of `media.store`, so the model sees the
84
+ image, and images that tools return go to the same store. See
85
+ [Images](../../README.md#images).
86
+
87
+ ## Development
88
+
89
+ Develop with uv 0.12.2. The package resolves `dex-agents`, the adapter, the
90
+ CLI core, and the shared test support from this repository by path. `ci.sh`
91
+ installs the locked dependencies, checks that `google-adk` and `google-genai`
92
+ match the adapter's lock, checks lint and types, and runs the tests against a
93
+ private `dexcli dev`:
94
+
95
+ ```bash
96
+ cd agents/cli/python/google-adk
97
+ DEXCLI=/path/to/dexcli ./ci.sh
98
+ ```
99
+
100
+ The tests run the command in a pseudo-terminal with a private home. ADK calls
101
+ the scripted Gemini API of [`../testing`](../testing) on 127.0.0.1 through
102
+ `GOOGLE_GEMINI_BASE_URL`; a refused proxy stops any other request. A fake
103
+ connectors MCP server serves a connector read and write. The tests cover a
104
+ chat turn and `--resume`, `read_file` without approval and `write_file` after
105
+ approval, a connector read and an approved connector write that runs once,
106
+ session settings that change the model, and a key in the `google_adk`
107
+ section. A `reasoning_effort` in the session settings fails the turn.
108
+ They also cover a `system_prompt` set in the session settings, which reaches
109
+ the next model request, and a rejected file write and connector write, which
110
+ never run.
@@ -0,0 +1,9 @@
1
+ dex_agents_google_adk_cli/__init__.py,sha256=ec735fF1IcaMf22PjfK3N6_n6FMomfAwn1DJ9ste3vo,1754
2
+ dex_agents_google_adk_cli/__main__.py,sha256=HvQ97Dgc77lDHVsivtawhcKUZovByd2dwlvMbBIopxM,439
3
+ dex_agents_google_adk_cli/harness.py,sha256=ZCY_jjVrPSaC7bU93KzXxXodyAg-cpNoNQ4LbEoJrOo,4611
4
+ dex_agents_google_adk_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ dex_agents_google_adk_cli-0.6.8.dist-info/licenses/LICENSE,sha256=0AJCV4ky-vrSnT08IIdYpyiFPPoF2UrtKsBAvuvt1G4,4220
6
+ dex_agents_google_adk_cli-0.6.8.dist-info/WHEEL,sha256=q9Wah2_CgP24mRNSlTyb0F8Yrbz55SzVl8eHLkZ_wvE,80
7
+ dex_agents_google_adk_cli-0.6.8.dist-info/entry_points.txt,sha256=usUJ6yb_PpMY3TCCoiPpLhP2sogPUSWHZRUqkaMshls,73
8
+ dex_agents_google_adk_cli-0.6.8.dist-info/METADATA,sha256=tQeUzSYQL-E6uK22XdfTsE6A_GcJT57294eA7yj0XCE,4977
9
+ dex_agents_google_adk_cli-0.6.8.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.12.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ dex-agents-google-adk = dex_agents_google_adk_cli:run
3
+
@@ -0,0 +1,105 @@
1
+ # License
2
+
3
+ Copyright (c) 2026 Super Durable, Inc.
4
+
5
+ Portions of this software are licensed as follows:
6
+
7
+ - Legacy Materials remain under their original licenses as described in
8
+ `LEGACY_NOTICES.md`.
9
+ - Third-Party Materials remain under the licenses provided by their owners.
10
+ - The `docs/` and `examples/` directories are not licensed under the
11
+ Sustainable Use License and retain their existing licensing status.
12
+ - All other material owned or licensable by Super Durable, Inc. is available
13
+ under the Sustainable Use License below.
14
+
15
+ See `LEGACY_NOTICES.md` for the applicable legacy and third-party notices.
16
+
17
+ ## Sustainable Use License
18
+
19
+ Version 1.0
20
+
21
+ ### Acceptance
22
+
23
+ By using the software, you agree to all of the terms and conditions below.
24
+
25
+ ### Copyright License
26
+
27
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
28
+ non-sublicensable, non-transferable license to use, copy, distribute, make
29
+ available, and prepare derivative works of the software, in each case subject
30
+ to the limitations below.
31
+
32
+ ### Limitations
33
+
34
+ You may use or modify the software only for your own internal business purposes
35
+ or for non-commercial or personal use. You may distribute the software or
36
+ provide it to others only if you do so free of charge for non-commercial
37
+ purposes. You may not alter, remove, or obscure any licensing, copyright, or
38
+ other notices of the licensor in the software. Any use of the licensor's
39
+ trademarks is subject to applicable law.
40
+
41
+ ### Patents
42
+
43
+ The licensor grants you a license, under any patent claims the licensor can
44
+ license, or becomes able to license, to make, have made, use, sell, offer for
45
+ sale, import and have imported the software, in each case subject to the
46
+ limitations and conditions in this license. This license does not cover any
47
+ patent claims that you cause to be infringed by modifications or additions to
48
+ the software.
49
+
50
+ If you or your company make any written claim that the software infringes or
51
+ contributes to infringement of any patent, your patent license for the software
52
+ granted under these terms ends immediately. If your company makes such a claim,
53
+ your patent license ends immediately for work on behalf of your company.
54
+
55
+ ### Notices
56
+
57
+ You must ensure that anyone who gets a copy of any part of the software from
58
+ you also gets a copy of these terms. If you modify the software, you must
59
+ include in any modified copies of the software a prominent notice stating that
60
+ you have modified the software.
61
+
62
+ ### No Other Rights
63
+
64
+ These terms do not imply any licenses other than those expressly granted in
65
+ these terms.
66
+
67
+ ### Termination
68
+
69
+ If you use the software in violation of these terms, such use is not licensed,
70
+ and your license will automatically terminate. If the licensor provides you
71
+ with a notice of your violation, and you cease all violation of this license no
72
+ later than 30 days after you receive that notice, your license will be
73
+ reinstated retroactively. However, if you violate these terms after such
74
+ reinstatement, any additional violation of these terms will cause your license
75
+ to terminate automatically and permanently.
76
+
77
+ ### No Liability
78
+
79
+ As far as the law allows, the software comes as is, without any warranty or
80
+ condition, and the licensor will not be liable to you for any damages arising
81
+ out of these terms or the use or nature of the software, under any kind of
82
+ legal claim.
83
+
84
+ ### Definitions
85
+
86
+ The "licensor" is the entity offering these terms.
87
+
88
+ The "software" is the software the licensor makes available under these terms,
89
+ including any portion of it.
90
+
91
+ "You" refers to the individual or entity agreeing to these terms.
92
+
93
+ "Your company" is any legal entity, sole proprietorship, or other kind of
94
+ organization that you work for, plus all organizations that have control over,
95
+ are under the control of, or are under common control with that organization.
96
+ Control means ownership of substantially all the assets of an entity, or the
97
+ power to direct its management and policies by vote, contract, or otherwise.
98
+ Control can be direct or indirect.
99
+
100
+ "Your license" is the license granted to you for the software under these
101
+ terms.
102
+
103
+ "Use" means anything you do with the software requiring your license.
104
+
105
+ "Trademark" means trademarks, service marks, and similar rights.