Skip to content

fix: collecting messages from agent #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025

Conversation

jmatejcz
Copy link
Contributor

@jmatejcz jmatejcz commented Apr 25, 2025

Purpose

fix collecting messages from agent, described in issue linked below.

Proposed Changes

in agent.stream() loop there is now counter for how many messages were already received and on each iteration only the [received_count: ] messages are appended.

Also fixed import issue in openset 161b696
which was introduced in some other refactors

Issues

#543

Testing

  1. Run src/rai_bench/rai_bench/examples/test_models.py in debug mode.
  2. Track messages appended in loop
    image
    Check if all unique(ids of messages) messages from state variable are appended to messages properly.

Do this for both tool calling agent and manipulaiton_o3de (change in src/rai_bench/rai_bench/examples/test_models.py selected benchamrk if needed).

@jmatejcz jmatejcz marked this pull request as ready for review April 25, 2025 12:19
@jmatejcz jmatejcz requested a review from maciejmajek April 27, 2025 09:35
@jmatejcz jmatejcz force-pushed the jm/fix/collecting_messages_from_agent branch from 161b696 to 1c27c7d Compare April 28, 2025 15:25
@@ -184,33 +184,36 @@ def run_next(self, agent: CompiledStateGraph) -> None:
tool_calls_num = 0

ts = time.perf_counter()
prev_count: int = 0
for state in agent.stream(
Copy link
Member

Choose a reason for hiding this comment

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

Why exactly are we using stream instead of invoke which returns all the messages under 'messages' key?

Copy link
Contributor Author

@jmatejcz jmatejcz Apr 29, 2025

Choose a reason for hiding this comment

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

so that we get partial results when Recursion Limit throws an error. I don't think it can be done, when using invoke() as it return output when whole execution is over

@jmatejcz jmatejcz force-pushed the jm/fix/collecting_messages_from_agent branch from 1c27c7d to 378e179 Compare April 29, 2025 08:41
@maciejmajek maciejmajek merged commit b62fee1 into development Apr 29, 2025
5 checks passed
@maciejmajek maciejmajek deleted the jm/fix/collecting_messages_from_agent branch April 29, 2025 09:19
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