Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:
If applicable, provide the version number or release tag where this
issue was encountered
options:
- v1.4.0
- v1.3.0
- v1.2.1
default: 0
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
[agntcy/dir]: https://github.com/agntcy/dir
[agntcy/dir-sdk-python]: https://github.com/agntcy/dir-sdk-python

## 1.4.0 (2026-06-12)

### Added

- `search_routing` for network-wide `RoutingService.Search`.
- `delete_referrer` for `StoreService.DeleteReferrer`.
- Annotation-based search support (`RECORD_QUERY_TYPE_ANNOTATION`) in tests and examples.

### Changed

- Updated buf-generated SDK dependencies to track [agntcy/dir][agntcy/dir] `v1.4.0`.
- Bumped the directory chart and `dirctl` image used in CI to `v1.4.0`.

## 1.3.0 (2026-05-12)

### Changed
Expand Down
8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Create a branch for the new release:
- `examples/pyproject.toml`
- `.github/ISSUE_TEMPLATE/bug_report.yml`
2. Update the dependencies if necessary:
- [agntcy-dir-grpc-python](https://buf.build/agntcy/dir/sdks/v1.3.0%3Agrpc/python?version=v1.78.0) (Buf SDK)
- [agntcy-dir-protocolbuffers-python](https://buf.build/agntcy/dir/sdks/v1.3.0%3Aprotocolbuffers/python?version=v34.0) (Buf SDK)
- [agntcy-dir-grpc-python](https://buf.build/agntcy/dir/sdks/v1.4.0%3Agrpc/python) (Buf SDK)
- [agntcy-dir-protocolbuffers-python](https://buf.build/agntcy/dir/sdks/v1.4.0%3Aprotocolbuffers/python) (Buf SDK)
- `.github/workflows/ci.yaml` (dir & dir-ctl version)
3. Add an entry to `CHANGELOG.md`

Expand All @@ -30,6 +30,6 @@ To trigger the release workflow, create and push the release tag
for the last commit:

```sh
git tag -a v1.3.0
git push origin v1.3.0
git tag -a v1.4.0
git push origin v1.4.0
```
14 changes: 14 additions & 0 deletions dir-sdk-python/agntcy/dir_sdk/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ def list(
) -> list[routing_v1.ListResponse]:
return self.routing_service.list(req, metadata=metadata)

def search_routing(
self,
req: routing_v1.SearchRequest,
metadata: Sequence[tuple[str, str]] | None = None,
) -> builtins.list[routing_v1.SearchResponse]:
return self.routing_service.search_routing(req, metadata=metadata)

def search_cids(
self,
req: search_v1.SearchCIDsRequest,
Expand Down Expand Up @@ -179,6 +186,13 @@ def delete(
) -> None:
self.store_service.delete(refs, metadata=metadata)

def delete_referrer(
self,
req: store_v1.DeleteReferrerRequest,
metadata: Sequence[tuple[str, str]] | None = None,
) -> store_v1.DeleteReferrerResponse:
return self.store_service.delete_referrer(req, metadata=metadata)

def create_sync(
self,
req: store_v1.CreateSyncRequest,
Expand Down
14 changes: 13 additions & 1 deletion dir-sdk-python/agntcy/dir_sdk/client/services/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

import builtins
import logging
from collections.abc import Sequence

Expand Down Expand Up @@ -34,13 +35,24 @@ def list(
self,
req: routing_v1.ListRequest,
metadata: Sequence[tuple[str, str]] | None = None,
) -> list[routing_v1.ListResponse]:
) -> builtins.list[routing_v1.ListResponse]:
return self._collect_stream(
"list",
"Failed to list objects",
lambda: self._routing_client.List(req, metadata=metadata),
)

def search_routing(
self,
req: routing_v1.SearchRequest,
metadata: Sequence[tuple[str, str]] | None = None,
) -> builtins.list[routing_v1.SearchResponse]:
return self._collect_stream(
"search_routing",
"Failed to search network",
lambda: self._routing_client.Search(req, metadata=metadata),
)

def unpublish(
self,
req: routing_v1.UnpublishRequest,
Expand Down
26 changes: 25 additions & 1 deletion dir-sdk-python/agntcy/dir_sdk/client/services/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import builtins
import logging
from collections.abc import Sequence
from collections.abc import Iterator, Sequence

from agntcy.dir_sdk.client.services.base import RpcServiceBase
from agntcy.dir_sdk.models import core_v1, store_v1
Expand Down Expand Up @@ -85,3 +85,27 @@ def delete(
"Failed to delete object",
lambda: self._store_client.Delete(iter(refs), metadata=metadata),
)

def delete_referrer(
self,
req: store_v1.DeleteReferrerRequest,
metadata: Sequence[tuple[str, str]] | None = None,
) -> store_v1.DeleteReferrerResponse:
def call() -> store_v1.DeleteReferrerResponse:
def request_iterator() -> Iterator[store_v1.DeleteReferrerRequest]:
yield req

responses = self._store_client.DeleteReferrer(
request_iterator(),
metadata=metadata,
)
for response in responses:
return response
msg = "DeleteReferrer returned no response"
raise RuntimeError(msg)

return self._invoke(
"delete_referrer",
"Failed to delete referrer",
call,
)
86 changes: 86 additions & 0 deletions dir-sdk-python/agntcy/dir_sdk/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,92 @@ def test_search(self) -> None:
for o in objects:
assert isinstance(o, search_v1.SearchCIDsResponse)

def test_search_annotation(self) -> None:
records = [
core_v1.Record(
data={
"name": f"agntcy-annotation-{uuid.uuid4().hex[:8]}",
"version": "v3.0.0",
"schema_version": "0.8.0",
"description": "Record with custom annotations.",
"authors": ["AGNTCY"],
"created_at": "2025-03-19T17:06:37Z",
"annotations": {"key": "value"},
"skills": [
{
"name": "natural_language_processing/natural_language_generation/text_completion",
"id": 10201,
}
],
"locators": [],
"domains": [{"name": "technology/networking", "id": 103}],
"modules": [],
}
)
]
record_refs = self.client.push(records=records)
assert len(record_refs) == 1

search_query = search_v1.RecordQuery(
type=search_v1.RECORD_QUERY_TYPE_ANNOTATION,
value="key:value",
)
search_request = search_v1.SearchCIDsRequest(queries=[search_query], limit=10)
objects = self.client.search_cids(search_request)

assert any(o.record_cid == record_refs[0].cid for o in objects)

def test_search_routing(self) -> None:
records = self.gen_records(1, "search_routing")
record_refs = self.client.push(records=records)

self.client.publish(
routing_v1.PublishRequest(
record_refs=routing_v1.RecordRefs(refs=record_refs),
)
)

time.sleep(5)

search_query = routing_v1.RecordQuery(
type=routing_v1.RECORD_QUERY_TYPE_DOMAIN,
value="technology/networking",
)
search_request = routing_v1.SearchRequest(queries=[search_query], limit=10)
objects = self.client.search_routing(search_request)

assert objects is not None
for obj in objects:
assert isinstance(obj, routing_v1.SearchResponse)

def test_delete_referrer(self) -> None:
records = self.gen_records(1, "delete_referrer")
record_refs = self.client.push(records=records)

push_response = self.client.push_referrer(
req=[
store_v1.PushReferrerRequest(
record_ref=record_refs[0],
type=sign_v1.Signature.DESCRIPTOR.full_name,
data={
"signature": "dGVzdC1zaWduYXR1cmU=",
"annotations": {"payload": "test-payload-data"},
},
)
]
)
assert len(push_response) == 1
assert push_response[0].success

delete_response = self.client.delete_referrer(
store_v1.DeleteReferrerRequest(
record=record_refs[0],
referrer_ref=push_response[0].referrer_ref,
)
)
assert delete_response is not None
assert len(delete_response.referrer_refs) > 0

def test_unpublish(self) -> None:
records = self.gen_records(1, "unpublish")
record_refs = self.client.push(records=records)
Expand Down
13 changes: 12 additions & 1 deletion examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def generate_record(name: str) -> core_v1.Record:
}
],
"domains": [{"name": "technology/networking", "id": 103}],
"annotations": {"env": "prod"},
"modules": [
{
"name": "integration/a2a",
Expand Down Expand Up @@ -93,7 +94,7 @@ def main() -> None:
for o in listed_objects:
print("Listed object:", MessageToJson(o))

# Search objects
# Search objects by version
search_query = search_v1.RecordQuery(
type=search_v1.RECORD_QUERY_TYPE_VERSION,
value="v1.*",
Expand All @@ -104,6 +105,16 @@ def main() -> None:

print("Searched objects:", search_results)

# Search objects by annotation key:value (v1.4)
annotation_query = search_v1.RecordQuery(
type=search_v1.RECORD_QUERY_TYPE_ANNOTATION,
value="env:prod",
)
annotation_results = client.search_cids(
search_v1.SearchCIDsRequest(queries=[annotation_query], limit=3),
)
print("Annotation search results:", annotation_results)

# Unpublish the object
record_refs = routing_v1.RecordRefs(refs=[refs[0]])
unpublish_request = routing_v1.UnpublishRequest(record_refs=record_refs)
Expand Down
4 changes: 2 additions & 2 deletions examples/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "agntcy-dir"
version = "1.3.0"
version = "1.4.0"
description = "Directory SDK"
readme = "README.md"
requires-python = ">=3.10"
Expand Down Expand Up @@ -36,6 +36,11 @@ agntcy-dir-protocolbuffers-python = { index = "buf" }
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
exclude = [
"/dir-sdk-python/agntcy/dir_sdk/tests",
]

[tool.hatch.build.targets.wheel]
packages = ["dir-sdk-python/agntcy"]

Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading