Skip to content

feat(server): record agent identity in the routing log - #1002

Merged
nachiketb-nvidia merged 3 commits into
NVIDIA-NeMo:mainfrom
eugenn:feature/routing-log-agent-identity
Oct 22, 2026
Merged

nachiketb-nvidia merged 3 commits into
NVIDIA-NeMo:mainfrom
eugenn:feature/routing-log-agent-identity

Conversation

@eugenn

@eugenn eugenn commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Routing logs now include agent identity so a child agent's calls can be distinguished from its parent's, even when they share a session ID.

Each record copies agent_id, parent_agent_id, agent_kind, and agent_role from request metadata. delegated uses Metadata::is_subagent_work(). subagent_identity_unsupported marks clients that cannot identify their child agents. Unset fields and false flags are omitted. Older records remain readable by the session stats endpoint.

The existing turn_id field from #971 is preserved alongside the agent fields.

Validation

One focused unit test writes a delegated call to JSONL and checks its session, turn, agent lineage, role, and delegation flag. It also checks that an unset unsupported-identity flag is omitted. The existing session snapshot test covers reading older records.

  • cargo fmt --all --check — passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed.
  • cargo test -p switchyard-server --locked — 99 passed.
  • git diff --check — passed.

Tests used local mock servers; no live model provider was called.

Summary by CodeRabbit

  • New Features
    • Routing logs can now include agent identity, parent-agent relationships, agent type and role, delegated-work status, and whether subagents are unsupported.
    • Agent details are omitted when unavailable, preserving the existing log format for requests without agent metadata.

@eugenn
eugenn requested a review from a team as a code owner October 15, 2026 08:41
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 69da51e9-3771-4c0a-b462-667d00f99b51
📥 Commits

Reviewing files that changed from the base of the PR and between ab7d264 and dbd46a8.

📒 Files selected for processing: 2
  • crates/switchyard-server/README.md
  • crates/switchyard-server/src/routing_log.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Walkthrough

Routing logs now capture agent IDs, parent IDs, delegation status, agent kind and role, and unsupported subagent identity. Unset fields and false flags are omitted. Missing fields default when older records are read.

Changes

Routing Log Agent Identity

Layer / File(s) Summary
Map request metadata to routing context
crates/switchyard-server/src/routing_log.rs
AgentIdentity captures agent IDs, kind, role, delegation status, and unsupported subagent identity from request metadata. RoutingLogContext now carries this identity.
Serialize and verify agent identity fields
crates/switchyard-server/src/routing_log.rs, crates/switchyard-server/README.md
RoutingLog::append copies identity fields into records. Optional fields and false flags are omitted, and missing fields default when older records are read. Tests and documentation cover these fields.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to dbd46

No merge-blocking issue is identified; the change is ready for normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: recording agent identity in the server routing log.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Docstring Coverage

Explanation

Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the log at night,
Agent trails are tucked in right.
Parent, child, and roles appear,
Empty fields just disappear.
Hop, the records read clear!

Comment @coderabbitai help to get the list of available commands.

@grahamking

Copy link
Copy Markdown
Contributor

Looks good, thanks @eugenn !

  1. Could you reduce the new unit tests from three to one? We're trying to avoid an AI driven test explosion.
  2. Please rebase it to solve merge conflict.

Signed-off-by: Eugen Nekhai <eugen.nekhai@gmail.com>
Signed-off-by: Eugen Nekhai <eugen.nekhai@gmail.com>
Signed-off-by: Eugen Nekhai <eugen.nekhai@gmail.com>
@eugenn
eugenn force-pushed the feature/routing-log-agent-identity branch from 40b38bd to f76d56a Compare October 20, 2026 08:55
@nachiketb-nvidia
nachiketb-nvidia merged commit 230be4e into NVIDIA-NeMo:main Oct 22, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants