Skip to content

feat(api): filter runtime workloads by agent, runtime and reachability - #2332

Merged
akijakya merged 2 commits into
mainfrom
feat/filter-runtime-workloads
Oct 13, 2026
Merged

akijakya merged 2 commits into
mainfrom
feat/filter-runtime-workloads

Conversation

@akijakya

@akijakya akijakya commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Adds agent and locator filters to ListWorkloadsRequest, so running workloads can be listed by what the agent in them can do and who stands behind it. The filters are implemented by dir-runtime (agntcy/dir-runtime#106) and exposed by dirctl runtime list (#2310); this PR changes the API and the Go client.

Changes

  • ListWorkloadsRequest: names, skills, domains, authors, schema_versions and locator_protocols, next to labels. The two filters that were only planned (commented out) become fields: runtime_types (e.g. docker, kubernetes, process) and reachable_from_workload_id (workloads sharing an isolation group with the given workload, excluding it; nothing matches if it doesn't exist). A workload matches a filter if it matches at least one of its values; different filters combine with AND, and an unset filter matches every workload. Values match as in record search: exactly (case-insensitive), or with * and ? wildcards, e.g. natural_language_processing/*. Locator protocols compare exactly.
  • Where the agent filters look: what the workload says about the agent it runs. That's its A2A card (services.a2a): the card's name, and the OASF discovery and identity extensions (skills, domains, schema version, and the DID of the human vouching for the agent). Anything the card doesn't provide comes from the OASF record the workload references (services.oasf). When both are present, the card wins. Workload itself gets no new fields: the values are read from the card and the record, not copied.
  • Workload.AgentInfo / Workload.MatchesFilters (api/runtime/v1/agent.go): shared helpers, so dir-runtime (filtering) and dirctl (display and re-filtering) read cards and records the same way. MatchesFilters evaluates every filter of the request, labels included, with the regex semantics dir-runtime uses today; the caller passes the workload named by reachable_from_workload_id in FilterOptions. Only extensions served by an accepted OASF schema server are read (<schema URL>[/<version>]/objects/discovery, default https://schema.oasf.outshift.com), so a schema server running locally works for testing and an unknown one is ignored.
  • Go client: ListWorkloadsWithRequest and ListWorkloadsStreamWithRequest send a full request; ListWorkloads / ListWorkloadsStream keep their label-only signature and call them.

Testing

  • task lint (golangci-lint in every module, buf lint, Helm) and buf breaking against main pass.
  • task test:unit passes, including tests for AgentInfo (card extensions, record fallback, unaccepted and configured schema servers) and MatchesFilters (every filter, wildcards, case, label regexes, reachability, AND), and client tests checking that every filter is passed through.

Notes

Closes #2307

@akijakya
akijakya requested a review from a team as a code owner October 12, 2026 15:57
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedOct 13, 2026, 1:09 PM

@github-actions github-actions Bot added the size/S Denotes a PR that changes 50-199 lines label Oct 12, 2026
@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch from 97dc6bc to d0eb580 Compare October 12, 2026 15:59
@akijakya akijakya self-assigned this Oct 12, 2026
@akijakya
akijakya requested a balanced review from Copilot October 12, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The API, generated bindings, compatibility wrappers, dependency mapping, and targeted tests are consistent and complete.

0 open findings

What changed in this PR

Adds OASF metadata and filtering support to the runtime workload API while preserving the existing label-only Go client methods.

Changes:

  • Adds workload skills/domains and request filters for skills, domains, and locator protocols.
  • Adds full-request Go client methods with compatibility wrappers.
  • Pins OASF protobuf dependencies and extends client/deep-copy tests.
File Description
proto/​buf.yaml Adds the pinned OASF dependency.
proto/​buf.lock Locks the OASF module revision.
proto/​buf.gen.yaml Maps OASF protos to published Go types.
proto/​agntcy/​dir/​runtime/​v1/​workload.proto Adds workload skills and domains.
proto/​agntcy/​dir/​runtime/​v1/​discovery_service.proto Adds workload filter fields and semantics.
client/​runtime.go Adds full-request list methods.
client/​runtime_test.go Tests filter and compatibility forwarding.
api/​runtime/​v1/​workload.pb.go Regenerates the workload Go API.
api/​runtime/​v1/​workload_test.go Tests deep-copy behavior for new fields.
api/​runtime/​v1/​discovery_service.pb.go Regenerates the discovery request Go API.
Files not reviewed (2)
  • api/runtime/v1/discovery_service.pb.go: Generated file
  • api/runtime/v1/workload.pb.go: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.37398% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/runtime/v1/agent.go 99.1% 1 Missing ⚠️
client/runtime.go 83.3% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch from d0eb580 to c3a0b2d Compare October 13, 2026 08:22
@akijakya
akijakya marked this pull request as draft October 13, 2026 09:01
@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch from c3a0b2d to 9d1acd5 Compare October 13, 2026 10:41
@github-actions github-actions Bot added size/M Denotes a PR that changes 200-999 lines and removed size/S Denotes a PR that changes 50-199 lines labels Oct 13, 2026
@akijakya akijakya changed the title feat(api): filter runtime workloads by skill, domain and locator protocol feat(api): filter runtime workloads by agent and locator protocol Oct 13, 2026
@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch from 9d1acd5 to 5c63814 Compare October 13, 2026 11:26
@akijakya akijakya changed the title feat(api): filter runtime workloads by agent and locator protocol feat(api): filter runtime workloads by agent, runtime and reachability Oct 13, 2026
@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch 2 times, most recently from c31580d to 80a15fb Compare October 13, 2026 11:43
Turn the planned runtime type and reachability filters of
ListWorkloadsRequest into fields, and add agent filters (names, skills,
domains, authors, schema versions) and a locator protocol filter. The
agent filters are evaluated against what a workload says about the
agent it runs: its A2A card, whose OASF discovery and identity
extensions carry skills, domains, schema version and author, and
otherwise the OASF record it references. Values match as in record
search: exactly (case-insensitive) or with * and ? wildcards.

Add Workload.AgentInfo and Workload.MatchesFilters, which evaluates
every filter of the request (labels included, with the regex semantics
dir-runtime uses today), so dir-runtime and dirctl filter the same way
without copying values into Workload. Only extensions served by an
accepted OASF schema server are read (https://schema.oasf.outshift.com
by default).

Add ListWorkloadsWithRequest and ListWorkloadsStreamWithRequest to the
Go client so callers can send the new filters; the label-only methods
now delegate to them.

Refs #2307

Signed-off-by: András Jáky <[email protected]>
@akijakya
akijakya force-pushed the feat/filter-runtime-workloads branch from 80a15fb to 5f5ed87 Compare October 13, 2026 11:55
@akijakya
akijakya marked this pull request as ready for review October 13, 2026 12:16
ramizpolic
ramizpolic previously approved these changes Oct 13, 2026

@ramizpolic ramizpolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Record fallback is incomplete and reachability can incorrectly cross discovery-instance boundaries.

3 open findings
Files not reviewed (1)
  • api/runtime/v1/discovery_service.pb.go: Generated file

🧠 Review effort: Balanced

Comment thread api/runtime/v1/agent.go Resolved
Comment thread api/runtime/v1/agent.go Resolved
Comment thread client/runtime.go Resolved
…ope reachability

AgentInfo now takes each of schema version, skills and domains from the
record unless the card's discovery extension provides it, so an
extension without domains keeps the record's domains.

Reachability only counts isolation groups within the same runtime and
discovery instance (org.agntcy/discovery-instance), since group names
such as "host", Kubernetes namespaces and Docker networks repeat across
hosts and clusters sharing a store.

Complete the client method comments.

Refs #2307

Signed-off-by: András Jáky <[email protected]>
@akijakya
akijakya added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 9252429 Oct 13, 2026
37 checks passed
@akijakya
akijakya deleted the feat/filter-runtime-workloads branch October 13, 2026 14:02
akijakya added a commit to agntcy/dir-runtime that referenced this pull request Oct 13, 2026
The commit on dir main that contains the workload locators (agntcy/dir#2302)
and the workload filters (agntcy/dir#2332).

Signed-off-by: András Jáky <[email protected]>
akijakya added a commit to agntcy/dir-runtime that referenced this pull request Oct 14, 2026
* chore(deps): bump dir API and client to the locators commit

Use github.com/agntcy/dir/api and client at cc5b967 (agntcy/dir#2302),
which adds Workload locators. The API now requires Go 1.27.1 and
k8s.io/apimachinery v0.37.1, so the Go toolchain (Taskfile, builder
images) and k8s.io/api and client-go move along. To be replaced by the
released tag before release.

Signed-off-by: András Jáky <[email protected]>

* feat(discovery): describe workload endpoints as locators

Signed-off-by: András Jáky <[email protected]>

* chore(chart): regenerate DiscoveredWorkload CRD with locators

Signed-off-by: András Jáky <[email protected]>

* chore(store): apply Go 1.27 embedded literal modernization

Signed-off-by: András Jáky <[email protected]>

* docs: document workload locators

Signed-off-by: András Jáky <[email protected]>

* chore(deps): pin dir API and client to agntcy/dir@9252429b

The commit on dir main that contains the workload locators (agntcy/dir#2302)
and the workload filters (agntcy/dir#2332).

Signed-off-by: András Jáky <[email protected]>

* fix(discovery): probe card URLs by the locator's protocol

The A2A resolver chose what to probe from the locator URL's scheme, so a
locator declared as slim (or grpc) with an http:// URL was probed. It now
decides from the declared protocol: tcp tries http and https, http and
https use that scheme, and every other protocol is skipped.

Also cover inspectToWorkload's host-mode branch, which derives locators
from the published port bindings.

Signed-off-by: András Jáky <[email protected]>

---------

Signed-off-by: András Jáky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter runtime workloads by agent, runtime and reachability

3 participants