Skip to content

Commit dd5ba04

Browse files
authored
Merge branch 'main' into fix/pipeline-error-callback
2 parents ea619ff + c08debc commit dd5ba04

35 files changed

Lines changed: 1226 additions & 522 deletions

File tree

.agents/skills/adk-sample-creator/SKILL.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ The `agent.py` should focus on demonstrating a specific feature or agent pattern
3030
> [!IMPORTANT]
3131
> **Model Selection**: Do not set the `model` parameter explicitly (e.g., `model="gemini-2.5-flash"`) on `Agent` instances in sample agents. Instead, let them default to the system-configured model, unless a specific model is explicitly requested by the user.
3232
33-
> [!IMPORTANT]
34-
> **Context Usage**: Prefer using the unified `Context` class (imported from
35-
> `google.adk`) instead of the legacy `ToolContext` or `CallbackContext`
36-
> aliases in callbacks and tool definitions.
37-
3833
Choose one of the following patterns:
3934

4035
#### Pattern A: Workflows (for complex graphs)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.2.0"
2+
".": "2.3.0"
33
}

.github/release-please-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@
5656
]
5757
}
5858
},
59-
"last-release-sha": "cd81f7bde91df78d6cece539a6f98dda2aa8c9c0"
59+
"last-release-sha": "0cb4c814928f579bfbac9b9e1f95669e4304e089"
6060
}

.github/workflows/copybara-pr-handler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ jobs:
5959
console.log(`Committer: ${committer}`);
6060
6161
// Check if this is a Copybara commit or has a pull request reference
62+
const prRegex = /Merges?:?\s+(?:https:\/\/github\.com\/google\/adk-python\/pull\/|#)(\d+)/i;
6263
const isCopybara = committer === 'Copybara-Service' ||
6364
commit.author?.email === 'genai-sdk-bot@google.com' ||
6465
message.includes('GitOrigin-RevId:') ||
6566
message.includes('PiperOrigin-RevId:') ||
66-
/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/.test(message);
67+
prRegex.test(message);
6768
6869
if (!isCopybara) {
6970
console.log('Not a Copybara commit, skipping');
7071
continue;
7172
}
7273
7374
// Extract PR number from commit message
74-
// Pattern matches both "Merge https://..." and "Merge: https://..."
75-
const prMatch = message.match(/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/);
75+
const prMatch = message.match(prRegex);
7676
7777
if (!prMatch) {
7878
console.log('No PR number found in Copybara commit message');

CHANGELOG.md

Lines changed: 145 additions & 0 deletions
Large diffs are not rendered by default.

contributing/samples/core/nested_state/README.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

contributing/samples/core/nested_state/__init__.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

contributing/samples/core/nested_state/agent.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/guides/workflow/dynamic_nodes/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ generate_headline = Agent(
3131
async def orchestrate(ctx: Context, node_input: str) -> str:
3232
# Dynamically execute the child agent and await its output
3333
headline = await ctx.run_node(generate_headline, node_input=node_input)
34-
34+
3535
yield Event(output=headline)
3636

3737
# Build the workflow
@@ -175,7 +175,7 @@ async def parallel_orchestrator(ctx: Context, node_input: list[str]):
175175
use_sub_branch=True, # Critical for parallel isolation
176176
)
177177
)
178-
178+
179179
# Await all tasks concurrently
180180
results = await asyncio.gather(*tasks)
181181
yield Event(output=results)

docs/guides/workflow/retry_config/index.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
In distributed systems and AI workflows, transient failures (such as network glitches, rate limits, or temporary service outages) are common. `RetryConfig` allows developers to define a resilient policy for individual nodes. When a node execution fails with a configured exception, the ADK will automatically retrying the node execution according to the specified delay and backoff strategy, before propagating the failure.
88

99
Key benefits:
10+
1011
- **Resilience**: Automatically recovers from transient errors.
1112
- **Configurable Backoff**: Supports exponential backoff to avoid overwhelming downstream services.
1213
- **Jitter**: Introduces randomness to retry delays to prevent thundering herd problems.
@@ -38,28 +39,34 @@ async def call_unstable_api(node_input: str):
3839

3940
When a node configured with `RetryConfig` raises an exception during execution:
4041

41-
1. **Exception Matching**: The `NodeRunner` catches the exception and checks if it matches any of the types specified in `RetryConfig.exceptions`. If `exceptions` is `None` (the default), it matches all exceptions.
42-
2. **Attempt Count Check**: It checks if the current attempt count is less than `max_attempts`.
43-
3. **Delay Calculation**: If a retry is warranted, it calculates the delay:
42+
1. **Exception Matching**: The `NodeRunner` catches the exception and checks if it matches any of the types specified in `RetryConfig.exceptions`. If `exceptions` is `None` (the default), it matches all exceptions.
43+
1. **Attempt Count Check**: It checks if the current attempt count is less than `max_attempts`.
44+
1. **Delay Calculation**: If a retry is warranted, it calculates the delay. The delay is capped at `max_delay`.
45+
46+
```math
4447
$$\text{delay} = \text{initial\_delay} \times (\text{backoff\_factor}^{\text{attempt} - 1})$$
45-
The delay is capped at `max_delay`.
46-
4. **Jitter Application**: If `jitter` is enabled (greater than 0.0), a random offset is added to the delay:
48+
```
49+
50+
4. **Jitter Application**: If `jitter` is enabled (greater than 0.0), a random offset is added to the delay. The final delay is guaranteed to be non-negative.
51+
52+
```math
4753
$$\text{delay} = \text{delay} + \text{random}(-jitter \times \text{delay}, jitter \times \text{delay})$$
48-
The final delay is guaranteed to be non-negative.
49-
5. **Execution Pause and Retry**: The runner sleeps for the calculated delay and then re-executes the node's logic.
54+
```
55+
56+
5. **Execution Pause and Retry**: The runner sleeps for the calculated delay and then re-executes the node's logic.
5057

5158
## Configuration options
5259

5360
`RetryConfig` is a Pydantic model with the following fields:
5461

55-
| Field | Type | Default | Description |
56-
| :--- | :--- | :--- | :--- |
57-
| `max_attempts` | `int \| None` | `5` (if omitted) | Maximum number of attempts, including the original request. If `0` or `1`, retries are disabled. |
58-
| `initial_delay` | `float \| None` | `1.0` | Initial delay before the first retry, in seconds. |
59-
| `max_delay` | `float \| None` | `60.0` | Maximum delay between retries, in seconds. |
60-
| `backoff_factor` | `float \| None` | `2.0` | Multiplier by which the delay increases after each attempt. |
61-
| `jitter` | `float \| None` | `1.0` | Randomness factor for the delay. Set to `0.0` to disable jitter (deterministic delays). |
62-
| `exceptions` | `list[str \| type[BaseException]] \| None` | `None` | Exceptions to retry on. Can be exception classes or their string names. `None` means retry on all exceptions. |
62+
| Field | Type | Default | Description |
63+
| :--------------- | :----------------------------------------- | :--------------- | :------------------------------------------------------------------------------------------------------------ |
64+
| `max_attempts` | `int \| None` | `5` (if omitted) | Maximum number of attempts, including the original request. If `0` or `1`, retries are disabled. |
65+
| `initial_delay` | `float \| None` | `1.0` | Initial delay before the first retry, in seconds. |
66+
| `max_delay` | `float \| None` | `60.0` | Maximum delay between retries, in seconds. |
67+
| `backoff_factor` | `float \| None` | `2.0` | Multiplier by which the delay increases after each attempt. |
68+
| `jitter` | `float \| None` | `1.0` | Randomness factor for the delay. Set to `0.0` to disable jitter (deterministic delays). |
69+
| `exceptions` | `list[str \| type[BaseException]] \| None` | `None` | Exceptions to retry on. Can be exception classes or their string names. `None` means retry on all exceptions. |
6370

6471
## Advanced applications
6572

0 commit comments

Comments
 (0)