Skip to content

feat(escalation): return task_id and assigned_to from escalation tool#517

Open
saksharthakkar wants to merge 5 commits intomainfrom
feat/escalation-info-return
Open

feat(escalation): return task_id and assigned_to from escalation tool#517
saksharthakkar wants to merge 5 commits intomainfrom
feat/escalation-info-return

Conversation

@saksharthakkar
Copy link
Contributor

@saksharthakkar saksharthakkar commented Feb 4, 2026

Motivation

Frontend needs task_id for constructing task URLs in traces:

/{tenantId}/actions_/tasks/{taskId}

Also need assigned_to for instrumentation/debugging purposes.

Summary

  • Return task_id and assigned_to from escalation tool for instrumentation
  • Simplify code by removing dead branches and unnecessary validation

Why the simplification?

interrupt() always returns a Task object for escalations, never a dict. The TypeAdapter.validate_python() path was dead code - Task is already a validated Pydantic model from the SDK.

Removed in escalation_tool_fn:

  1. if isinstance(result, dict): branch - never true
  2. TypeAdapter.validate_python() call - unnecessary validation
  3. Defensive fallbacks (or result.get("key"), or result.get("assignedToUser"))

Simplified in escalation_wrapper:

  1. Removed model_dump() check - output is always a dict
  2. Removed isinstance(output, dict) check - dead code
  3. Consolidated return into single dict spread

Test plan

  • Existing escalation tests pass
  • Verify task_id and assigned_to are returned in escalation output
image

@saksharthakkar saksharthakkar force-pushed the feat/escalation-info-return branch from 9fc49e4 to 2fb80b7 Compare February 4, 2026 19:03
saksharthakkar and others added 3 commits February 4, 2026 12:15
- Add _get_user_email helper to extract emailAddress from user object/dict
- Extract task_id and assigned_to from escalation result for instrumentor
- Return interrupt() result to capture Task object
- Rename escalation_action to outcome for consistency
- Store call_id and call_args in tool metadata
interrupt() always returns Task object for escalations, not dict.
Remove dead dict branch and defensive fallbacks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove dead code - output is always a dict from escalation_tool_fn.
model_dump() and isinstance checks were unnecessary.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@saksharthakkar saksharthakkar force-pushed the feat/escalation-info-return branch from 4d67a75 to 4e34462 Compare February 4, 2026 20:15
saksharthakkar and others added 2 commits February 4, 2026 12:19
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@saksharthakkar saksharthakkar changed the title (wip) feat(escalation): return task_id and assigned_to from escalation tool feat(escalation): return task_id and assigned_to from escalation tool Feb 4, 2026
@saksharthakkar saksharthakkar marked this pull request as ready for review February 4, 2026 21:28
Copy link
Collaborator

@akshaylive akshaylive left a comment

Choose a reason for hiding this comment

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

Mostly looks good. Please test it in a simulation context as well.

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.

2 participants