Skip to content

Commit 09f7a6f

Browse files
authored
Merge pull request #313 from CasperGN/feat/bubble-appid-metadata
feat: bubble out appid into metadata
2 parents 4f5e075 + 8939089 commit 09f7a6f

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

dapr_agents/agents/components.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ def __init__(
6868
self.name = name
6969
self._workflow_grpc_options = workflow_grpc_options
7070

71-
if pubsub is None or state is None or registry is None:
72-
with DaprClient() as _client:
73-
resp: GetMetadataResponse = _client.get_metadata()
71+
with DaprClient() as _client:
72+
resp: GetMetadataResponse = _client.get_metadata()
73+
self.appid = resp.application_id
74+
if pubsub is None or state is None or registry is None:
7475
components: Sequence[RegisteredComponents] = resp.registered_components
7576
for component in components:
7677
if (
@@ -513,6 +514,7 @@ def register_agentic_system(
513514
payload["agent"] = {}
514515

515516
payload["agent"]["type"] = type(self).__name__
517+
payload["agent"]["appid"] = self.appid
516518
payload.setdefault("registered_at", datetime.now(timezone.utc).isoformat())
517519

518520
if self._pubsub is not None:

tests/agents/durableagent/test_durable_agent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def get_metadata(self):
9191

9292
response = MagicMock()
9393
response.registered_components = []
94+
response.application_id = "test-app-id"
9495
return response
9596

9697

tests/agents/durableagent/test_mcp_streamable_http.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def get_metadata(self):
5353

5454
response = MagicMock()
5555
response.registered_components = []
56+
response.application_id = "test-app-id"
5657
return response
5758

5859
statestore.DaprClient = MockDaprClient

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def get_metadata(self):
113113
"""Mock get_metadata that returns empty metadata."""
114114
response = MagicMock()
115115
response.registered_components = []
116+
response.application_id = "test-app-id"
116117
return response
117118

118119

0 commit comments

Comments
 (0)