feat: add observability metadata to tools and guardrails #384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add metadata to tools and guardrails for observability span detection.
Changes:
escalation_tool.py: Add metadata (tool_type,display_name,channel_type,assignee)process_tool.py: Add metadata (tool_type,display_name,folder_path)guardrail_nodes.py: Attach__metadata__attribute (guardrail_name,guardrail_scope,guardrail_stage,tool_name)Metadata usage
Core (span detection):
tool_type,display_name→ identify interruptible tool type and span nameSpan attributes (temporal parity):
channel_type,assignee,folder_path→ additional span attributesWhy
tool_namein guardrail metadata?For TOOL scope guardrails, correlates guardrail span with parent tool span for proper hierarchy.
Why
__metadata__for nodes butmetadatafor tools?StructuredToolhas built-inmetadataparam. Guardrail nodes are plain async functions—need manual__metadata__attribute that callbacks read viagetattr().Why
Metadata is the cleanest approach: it's the standard LangChain pattern, flows automatically to callbacks, and requires no parsing.
tool_typeis explicit because Python SDK tools share the sameStructuredToolbase class—unlike temporal's polymorphicGetToolType(), we can't derive type from class hierarchy.Removes name-based hacks in
uipath-agents-pythoncallback: