Skip to content

Enhancement: AgentTopology needs pruning and last_updated field #2167

@mrveiss

Description

@mrveiss

Problem

`agents/agent_orchestration/topology.py` (PR #2149) has no mechanism to limit topology growth:

  • No `last_updated` timestamp on `AgentConnection` (design doc schema includes it)
  • No pruning of stale/low-weight connections
  • No max connection count or LRU eviction
  • Growth is O(A² × T) where A = distinct agent IDs, T = task types

With free-form string agent IDs (not enum-constrained), connection count is unbounded. Compare with `mesh_pruner.py` which actively deletes edges below `min_weight`.

Discovered During

Code review of PR #2149 (AgentTopology)

Recommended Fix

  1. Add `last_updated: Optional[datetime]` to `AgentConnection`
  2. Add `prune_stale_connections(max_age_days, min_weight)` method
  3. Document the bounded assumption (agent IDs map to ~13 AgentType values)

Impact

Severity: medium — bounded in current usage, unbounded if agent IDs become dynamic

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions