Skip to content

[Epic] Manager-scoped agent discovery via org hierarchy resolver #1468

Description

@vivekkrishna

Problem Statement

The Agent Directory Service supports annotation-based search (e.g., `owner.id: alice@example.com`), but there is no way to ask: "give me all agents owned by anyone in Alice's org subtree."

Today a user must:

  1. Manually query their HR/directory system to enumerate every IC under a given manager
  2. Issue one search per owner alias, or construct the full owner list themselves

This is impractical at scale — a manager may have hundreds of direct and indirect reports — and it puts the burden of org resolution on the caller.

Proposed Solution

Introduce a pluggable OrgResolver interface in the ADS server that can expand a manager alias into a full list of aliases in their reporting chain. This enables a single query:

```
dirctl search --manager alice@example.com
```

Which internally:

  1. Calls the configured OrgResolver with `alice@example.com`
  2. Receives the full subtree: `[alice, bob, carol, dave, ...]`
  3. Fans out to annotation search: `owner.id IN [alice, bob, carol, dave, ...]`
  4. Returns all matching agent records

OrgResolver interface (sketch):
```go
type OrgResolver interface {
// Expand returns the manager and all direct/indirect reports under them.
Expand(ctx context.Context, managerAlias string) ([]string, error)
}
```

Resolver implementations (pluggable, configured in server config):

  • static — file-based mapping (YAML/JSON), useful for testing and air-gapped environments
  • http — generic REST adapter with configurable endpoint and response mapping, covers Workday, BambooHR, and other HR APIs without hard-coding vendor logic

The resolver is optional — when unconfigured, --manager returns an error and all other search behavior is unaffected.

Annotation convention (recommended, not enforced):
```
annotations:
owner.id: "alice@example.com"
owner.type: "user"
```

Alternatives Considered

Client-side resolution: The CLI could call the HR system directly and pass the expanded owner list to annotation search. Simpler to implement, but leaks org structure to every client, requires every CLI user to have credentials for the HR system, and duplicates resolver logic across clients.

Per-vendor integrations (Workday, BambooHR, LDAP): Tight integrations with specific HR APIs would provide richer data but introduce vendor coupling and maintenance burden. A generic HTTP adapter with configurable field mapping covers the same cases without lock-in.

New first-class schema field: Adding a dedicated owner schema block (Phase 2 of #1445) would be more structured, but adds schema complexity and migration burden. The annotation-based approach delivers immediate value with zero schema changes.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/researchCategorizes issue or PR as related to research activities.no-staleDenotes an issue or PR that should be preserved from going stale.triage/community-reviewtriage/needs-informationIndicates an issue or PR needs more information in order to work on it.

    Type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions