The list_agents method in AgentLoader no longer attempts to determine the agent language for each directory
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 890078066
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout.
- Update unit tests to fully assert integration migration.
Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 889963735
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout.
- Update unit tests to fully assert integration migration.
PiperOrigin-RevId: 889891348
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout.
- Update unit tests to fully assert integration migration.
PiperOrigin-RevId: 889796517
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout.
- Update unit tests to fully assert integration migration.
Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 889634966
Introduces a new helper function, `_get_or_create_state`, which uses a nested transaction (SAVEPOINT) to safely attempt creating a state row. If a concurrent transaction has already inserted the row, the inner insert will fail with an IntegrityError, which is caught, and the already-existing row is then fetched
Close#4954
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 889441684
Update the `model_config` for `Event` to set `extra='ignore'`. This allows the `Event` model to be initialized with fields not explicitly defined in the model, preventing errors when deserializing data that may contain additional, unneeded fields. This allows the session service to accept 2.0 events.
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 889327445
Introduces a new index `idx_events_app_user_session_ts` on the `events` table in both V0 and V1 database schemas. This index covers `app_name`, `user_id`, `session_id`, and `timestamp` (descending) to improve query performance.
Modifies `DatabaseSessionService` to automatically create any missing indexes defined in the SQLAlchemy metadata when preparing the database tables.
Close#4827
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 888877174
Versions 1.82.7 and 1.82.8 of LiteLLM were affected by a supply chain attack and are now explicitly excluded from the dependency constraints for both project and dev dependencies.
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 888818704
The log message when instantiating DatabaseSessionService is updated from "Falling back to..." to "Using..." for clarity.
Close#4890
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 888160397
This change enables the conversion of ADK EventActions, serialized within A2A object metadata, back into ADK Event objects. It includes logic to parse JSON-encoded metadata values and to merge EventActions from multiple sources within an A2A Task
Close#3968
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 886927688
Support Starlette lifespan protocol in to_a2a() so users can run
async startup/shutdown logic (e.g. initializing DB connections,
loading prompt registries) without resorting to module-level globals.
The lifespan parameter accepts a standard Starlette async context
manager. Internally, a composed lifespan runs the A2A route setup
first, then delegates to the user's lifespan if provided. This also
replaces the deprecated add_event_handler("startup", ...) pattern
with the modern Starlette(lifespan=...) constructor.
Closes#4701
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 886892363
DiscoveryEngineSearchTool hardcoded search_result_mode to CHUNKS, which
fails with a 400 error for structured datastores (e.g. Jira Cloud
connectors) that require DOCUMENTS mode. This broke VertexAiSearchTool
with bypass_multi_tools_limit=True for structured data.
Add auto-detection: default mode is now None, which tries CHUNKS first
and automatically falls back to DOCUMENTS when the API returns the
structured-datastore error. Users can also explicitly set the mode via
the new SearchResultMode enum to skip auto-detection.
Fixes#3406
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 886354417
Kebab-case is the standard for skill names/directories given by the Skill spec. However, to enable support for importing within skill scripts (python does not allow imports with kebab-case, only snake case), allow snake case for the skill name.
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 886351132
Modified compaction logic to exclude events containing function calls for which no corresponding function response has been recorded in the session. Added helper functions to identify pending function call IDs and check if an event contains such IDs. Applied this exclusion to both sliding window and token threshold-based compaction strategies
Close#4740
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 886268526
This change introduces a separate async session factory for Spanner connections configured with `read_only=True`
Close#4771
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 886267104
The ADK experimental warnings can already be disabled with an environment
variable, enable the same behavior for A2A to avoid log spam.
Co-authored-by: Tim Niemueller <timdn@google.com>
PiperOrigin-RevId: 886233489
- Introduced a new `AuthScheme` named `GcpIamConnectorAuth` in `google.adk.integrations.iam_connector` package.
- The feature is currently disabled through the newly added `GCP_IAM_CONNECTOR_AUTH`experimentation flag.
- The newly added `GcpAuthProvider` class in `adk/integrations/iam_connector/gcp_auth_provider.py` is for internal ADK use and developer should not depend on it.
PiperOrigin-RevId: 886070137
Renames the imported module from `agentic_sandbox` to `k8s_agent_sandbox` in `gke_code_executor.py` and updates the required version in `pyproject.toml` to `>=0.1.1.post3`.
Closes#4883
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 885840142
Merge https://github.com/google/adk-python/pull/4780
## Bug
`AnthropicLlm.part_to_message_block()` only serializes `FunctionResponse.response` dicts that contain a `"content"` or `"result"` key. When neither key is present the variable `content` stays as `""` and an empty `ToolResultBlockParam` is sent to Claude.
This silently drops the output of several `SkillToolset` tools:
| Tool | Keys returned | Handled before this fix? |
|---|---|---|
| `load_skill` (success) | `skill_name`, `instructions`, `frontmatter` | **No** |
| `run_skill_script` (success) | `skill_name`, `script_path`, `stdout`, `stderr`, `status` | **No** |
| Any skill tool (error) | `error`, `error_code` | **No** |
| `load_skill_resource` (success) | `skill_name`, `path`, `content` | Yes (`"content"` key) |
Because `load_skill` is the entry-point for skill instructions, Claude models using `SkillToolset` **never received skill instructions**, making the feature completely non-functional with Anthropic models.
## Fix
Added an `else` branch in `part_to_message_block()` that JSON-serializes the full response dict when neither `"content"` nor `"result"` is present:
```python
elif response_data:
# Fallback: serialize the entire response dict as JSON so that tools
# returning arbitrary key structures (e.g. load_skill returning
# {"skill_name", "instructions", "frontmatter"}) are not silently
# dropped.
content = json.dumps(response_data)
```
This is consistent with how Gemini handles it — the Gemini integration passes `types.Part` objects directly to the Google GenAI SDK which serializes them natively, so there is no key-based filtering at all.
## Testing plan
Added 4 new unit tests to `tests/unittests/models/test_anthropic_llm.py`:
- `test_part_to_message_block_arbitrary_dict_serialized_as_json` — covers the `load_skill` response shape
- `test_part_to_message_block_run_skill_script_response` — covers the `run_skill_script` response shape
- `test_part_to_message_block_error_response_not_dropped` — covers error dict responses
- `test_part_to_message_block_empty_response_stays_empty` — ensures empty dict still produces empty content (no regression)
All 35 tests in `test_anthropic_llm.py` pass:
```
35 passed in 7.32s
```
Run with:
```bash
uv sync --extra test
pytest tests/unittests/models/test_anthropic_llm.py -v
```
Co-authored-by: Kathy Wu <wukathy@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4780 from akashbangad:fix/anthropic-llm-skill-toolset-fallback c23ad3755f94eb8c914203a6389bd3fa755c70be
PiperOrigin-RevId: 885831845
RunConfig.response_modalities is typed as list[str] for backward
compatibility, but LiveConnectConfig.response_modalities expects
list[Modality] (an enum). Assigning strings directly causes a Pydantic
serialization warning on every live streaming session:
PydanticSerializationUnexpectedValue(Expected `enum` - serialized
value may not be as expected [field_name='response_modalities',
input_value='AUDIO', input_type=str])
Convert each modality value to types.Modality at the assignment point in
basic.py using types.Modality(m), which is a no-op for values that are
already Modality enums and converts plain strings like "AUDIO" to
Modality.AUDIO. The public RunConfig interface remains list[str] so
existing callers are unaffected.
Fixes: #4869
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 885781014
This change introduces optimistic concurrency control for session updates. Instead of automatically reloading and merging when an append is attempted on a session that has been modified in storage, the service now raises a ValueError.
Close#4751
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 885334444
When PR #2872 migrated RestApiTool from requests (sync) to
httpx.AsyncClient (async), the _request function was left without an
explicit timeout parameter. Unlike requests which has no default timeout,
httpx defaults to 5 seconds — causing ReadTimeout errors for any API
call exceeding that limit. This regression blocked users from upgrading
past 1.23.0.
Set timeout=None on httpx.AsyncClient to restore parity with the
previous requests-based behavior (no timeout).
Fixes#4431
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 885287948