Commit Graph

1816 Commits

Author SHA1 Message Date
George Weale 055dfc7974 fix: Normalize multipart content for LiteLLM's ollama_chat provider
LiteLLM's `ollama_chat` provider does not accept array-based content in messages. This change flattens multipart content by joining text parts or JSON-serializing non-text parts before sending the request to the LiteLLM completion API. This ensures compatibility with Ollama's chat endpoint.

Close #3727

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 843382361
2025-12-11 14:46:37 -08:00
Yifan Wang df8684734b chore: update adk web, fixes image not rendering, state not updating, update drop down box width and trace icons
Co-authored-by: Yifan Wang <wanyif@google.com>
PiperOrigin-RevId: 843378628
2025-12-11 14:36:40 -08:00
Google Team Member 9cccab4537 fix: installing dependencies for py 3.10
PiperOrigin-RevId: 843378433
2025-12-11 14:35:51 -08:00
Xuan Yang e1a7593ae8 feat: Add header_provider to OpenAPIToolset and RestApiTool
Fixes: https://github.com/google/adk-python/issues/3782

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 843352147
2025-12-11 13:29:00 -08:00
Xuan Yang cb3244bb58 feat: Use json schema for function tool declaration when feature enabled
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 843350330
2025-12-11 13:24:41 -08:00
George Weale 894d8c6c26 fix: Refactor LiteLLM response schema formatting for different models
The `_to_litellm_response_format` function now adapts the output format based on the provided model. Gemini models continue to use the "response_schema" key, while OpenAI-compatible models (including Azure OpenAI and Anthropic) now use the "json_schema" key as per LiteLLM's documentation for JSON mode. The schema name is also included in the "json_schema" format.

Close #3713
Close #3890

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 843326850
2025-12-11 12:20:11 -08:00
George Weale 99f893ae28 fix: Resolve project and credentials before creating Spanner client
Explicitly resolve the GCP project from arguments or environment variables before calling `spanner.Client`. This avoids redundant calls to `google.auth.default()` that newer versions of the Spanner library might make.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 843320305
2025-12-11 12:03:10 -08:00
Google Team Member 7b2fe14dab feat: Upgrade BigQueryAgentAnalyticsPlugin to v2.0
Performance: Switched to BigQuery Storage Write API with async batching, reducing agent latency.
Multimodal: Native support for GCS offloading (ObjectRef) for images, video, and large text.
Reliability: Added connection pooling, retries, and a "rescue flush" for safe shutdown on Cloud Run.
Observability: Fixed distributed tracing hierarchy with ContextVars support.
PiperOrigin-RevId: 843062561
2025-12-10 23:04:01 -08:00
Xiang (Sean) Zhou 68d70488b9 chore: Add sample agent for interaction api integration
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 843037705
2025-12-10 21:37:03 -08:00
Xiang (Sean) Zhou c6320caaa5 feat: Support interactions API for calling models
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 843032402
2025-12-10 21:21:14 -08:00
Xiang (Sean) Zhou f0bdcaba44 chore: Update genAI SDK version
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 843030125
2025-12-10 21:13:52 -08:00
George Weale 7b356ddc1b feat: Add add_session_to_memory to CallbackContext and ToolContext
This change introduces an add_session_to_memory method to both CallbackContext and ToolContext, allowing agents and tools to explicitly trigger the saving of the current session to the memory service. This enables more fine-grained control over when session data is persisted for memory generation. A ValueError is raised if the memory service is not configured.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 843021899
2025-12-10 20:47:08 -08:00
Krishna vamsi Dhulipalla 4111f85b61 docs(adk): fix run_async example and correct ticketId payload key
Merge https://github.com/google/adk-python/pull/3875

# Problem
The example in `contributing/samples/human_in_loop/README.md` shows:

```python
await runner.run_async(...)
```

However, `run_async` returns an **async generator**, so awaiting it raises:

```
TypeError: object async_generator can't be used in 'await' expression
```

Additionally, the example payload uses `"ticket-id"` while ADK tools and other examples use `"ticketId"`, creating a mismatch that breaks copy/paste usage.

# Solution
- Updated the snippet to consume the async generator correctly:

```python
async for event in runner.run_async(...):
    ...
```

- Aligned the payload key from `"ticket-id"` → `"ticketId"` for consistency with ADK schema and other examples.

These changes make the example runnable and consistent with the API’s actual behavior.

# Testing Plan
This PR is a **small documentation correction**, so no unit tests are required per contribution guidelines.

- Verified the corrected snippet manually to ensure it no longer raises `TypeError`.

# Checklist
- [x] I have read the CONTRIBUTING.md document.
- [x] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas. *(N/A – docs only)*
- [ ] I have added tests that prove my fix is effective or that my feature works. *(N/A – docs only)*
- [ ] New and existing unit tests pass locally with my changes. *(N/A – docs only)*
- [x] I have manually tested my changes end-to-end.
- [ ] Any dependent changes have been merged and published in downstream modules. *(N/A)*

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3875 from krishna-dhulipalla:docs/fix-adk-run_async-example 83fc5b430690b63b8b7bf1025ef03b0761264751
PiperOrigin-RevId: 842952362
2025-12-10 17:24:58 -08:00
Xuan Yang b23deeb9ab docs: Update adk docs update workflow to invoke the updater agent once per suggestion
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 842789476
2025-12-10 10:45:05 -08:00
Xuan Yang 51a638b6b8 chore: Introduce build_function_declaration_with_json_schema to use pydantic to generate json schema for FunctionTool
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 842783745
2025-12-10 10:31:09 -08:00
George Weale 6388ba3b20 fix: Avoid false positive "App name mismatch" warnings in Runner
When users instantiate LlmAgent directly (not subclassed), the origin inference incorrectly detected ADK's internal google/adk/agents/ path as a mismatch.

Use metadata from AgentLoader when available
Skip inference for google.adk.* module

Close #3143

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 842774292
2025-12-10 10:08:37 -08:00
Google Team Member 4f54660d6d fix: Update the code to work with either 1 event or more than 1 events
Update the code to work with either 1 event or more than 1 events.

PiperOrigin-RevId: 842406345
2025-12-09 14:48:25 -08:00
Xiang (Sean) Zhou ee743bd19a chore: Update component definition for triaging agent
Context: many issues related to local mult-agent system is tagged with a2a

Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 842397159
2025-12-09 14:25:18 -08:00
Xuan Yang bab57296d5 chore: Migrate Google tools to use the new feature decorator
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 842321126
2025-12-09 11:21:06 -08:00
Xuan Yang 1ae944b39d chore: Migrate computer to use the new feature decorator
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 842287104
2025-12-09 10:03:43 -08:00
hoonji 32e87f6381 feat: Adds ADK EventActions to A2A response
Merge https://github.com/google/adk-python/pull/3631

### Link to Issue or Description of Change

**1. Link to an existing issue (if applicable):**

- Closes: #3630

**Solution:**
Adds [Event.actions](https://github.com/google/adk-python/blob/a3aa07722a7de3e08807e86fd10f28938f0b267d/src/google/adk/events/event.py#L51) to A2A event metadata during ADK -> A2A event conversion (to allow A2A event consumers to access important info like state_delta, artifact delta, etc)

### Testing Plan

`pytest ./tests/unittests` passes

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3631 from hoonji:main 31d3a49ad630bbd778aa4cf62dd9ccfc50f5b7af
PiperOrigin-RevId: 842274939
2025-12-09 09:32:36 -08:00
George Weale 56775afc48 fix: OpenAPI schema generation by skipping JSON schema for judge_model_config
Close #3750

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 841991676
2025-12-08 18:20:41 -08:00
Google Team Member cde7f7c243 feat: Allow overriding connection template
PiperOrigin-RevId: 841984336
2025-12-08 17:54:25 -08:00
Xuan Yang 82e6623fa9 fix: Add tool_name_prefix support to OpenAPIToolset
Fixes: https://github.com/google/adk-python/issues/3779

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 841850614
2025-12-08 11:35:08 -08:00
Google Team Member 143ad44f8c fix: pass context to client inceptors
PiperOrigin-RevId: 840918430
2025-12-05 16:26:20 -08:00