Skip to content

Conversation

mpenn
Copy link
Contributor

@mpenn mpenn commented Sep 23, 2025

Description

Closes

This PR improves error handling during function invocation and llm/tool call failures in LangchainCallbackHandler to ensure proper closures of spans during export. This ensures proper nesting of traces. This includes an the following updates to the IntermediateStep:

  • addition of IntermediateStepPayload.status attribute to represent invocation success/failure
  • ErrorDetails to provide additional error details in the metadata attribute

This PR also resolves memory leaks in the LangchainCallbackHandler

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

…filerHandler

- Introduced standardized error details capturing in IntermediateStepPayload with ErrorDetails model.
- Updated Context class to emit success or error events based on function execution outcomes, including detailed error metadata.
- Enhanced LangchainProfilerHandler to handle LLM and tool errors, pushing error events with relevant details to the step manager.
- Added EventStatus enumeration to track the status of intermediate steps, improving observability in processing flows.

This ensures proper nesting of spans, event in the event of tool
call/llm/function invocation failures

Signed-off-by: Matthew Penn <[email protected]>
Copy link

coderabbitai bot commented Sep 23, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@mpenn mpenn self-assigned this Sep 23, 2025
@mpenn mpenn added bug Something isn't working non-breaking Non-breaking change labels Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant