Skip to content

Commit c3de34f

Browse files
authored
Merge branch 'main' into fix-thought-signature-pruning
2 parents b832dbd + 50c81eb commit c3de34f

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/google/adk/agents/context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ def function_call_id(self, value: str | None) -> None:
245245
"""Sets the function call id of the current tool call."""
246246
self._function_call_id = value
247247

248+
@property
249+
def branch(self) -> str | None:
250+
"""The branch path of the current invocation context."""
251+
return self._invocation_context.branch
252+
248253
@property
249254
def isolation_scope(self) -> str | None:
250255
"""Scope tag inherited from parent or set explicitly via override.

tests/unittests/agents/test_context.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ def mock_invocation_context():
4040
mock_context.session.id = "test-session-id"
4141
mock_context.app_name = "test-app"
4242
mock_context.user_id = "test-user"
43+
mock_context.branch = "test-branch"
4344
mock_context.artifact_service = None
4445
mock_context.credential_service = None
4546
mock_context.memory_service = None
4647
return mock_context
4748

4849

50+
def test_context_branch_returns_invocation_branch(mock_invocation_context):
51+
"""Context.branch returns the branch from the underlying invocation context."""
52+
mock_invocation_context.branch = "test-branch"
53+
context = Context(invocation_context=mock_invocation_context)
54+
55+
assert context.branch == "test-branch"
56+
57+
4958
@pytest.fixture
5059
def mock_artifact_service():
5160
"""Create a mock artifact service for testing."""

0 commit comments

Comments
 (0)