Skip to content

fix: skip tool_use blocks lacking an id - #24

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
HeaTTap:skip-tool-use-without-id
Sep 5, 2026
Merged

fix: skip tool_use blocks lacking an id#24
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
HeaTTap:skip-tool-use-without-id

Conversation

@HeaTTap

@HeaTTap HeaTTap commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What & why

A transcript with a tool_use block lacking an id crashed parse_session with KeyError instead of skipping the block. This PR ensures tool_use blocks without an id are safely skipped, matching the sibling tool_result handling.

Closes #19

Changes

  • In agentrace/parse.py, safely retrieve the id from tool_use blocks and only store when present.
  • In tests/test_agentrace.py, add test_tool_use_without_id_is_skipped asserting transcripts with id-less tool_use blocks parse without error.

Checklist

  • Focused change with a clear description
  • Ran format / lint / tests (see README)
  • Updated docs or CHANGELOG if relevant
  • Linked any related issue (e.g. Closes #123)

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Welcome, @HeaTTap, and thanks for your first pull request to Agentrace.

A quick look at CONTRIBUTING.md covers how things are set up and run here.

I'll review this shortly. Ask anything in the thread if something is unclear.

@royalpinto007
royalpinto007 merged commit 5ddb84b into AgentPostmortem:main Sep 5, 2026
8 checks passed
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

And it's in. Thanks @HeaTTap.

Contributions like this are what keep Agentrace moving.

A star on the repo would mean a lot if this project is useful to you.

Happy to see more from you whenever you have the time.

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.

tool_use block without id crashes parse_session with KeyError

2 participants