Skip to content
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

get_role helper to get access to a different role of the same agent #163

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

maurerle
Copy link
Collaborator

I'd like to have a feature like this to directly call a method of a given role from a role which extends the behavior of a different role.

We could instead change this to return the result of the function call directly, which would make adding params a little weirder though.

No tests yet, will be added once the idea is discussed :)

What do you think? @rcschrg

@maurerle maurerle requested a review from rcschrg February 19, 2025 22:01
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.23%. Comparing base (5c68841) to head (d84f8dc).

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #163      +/-   ##
===============================================
+ Coverage        89.20%   89.23%   +0.02%     
===============================================
  Files               22       22              
  Lines             2502     2507       +5     
===============================================
+ Hits              2232     2237       +5     
  Misses             270      270              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rcschrg
Copy link
Member

rcschrg commented Mar 3, 2025

Hey @maurerle,

What would be the use case? I don't like this style. Further, does it work without having the role object? You would need to provide the self-object, right?

I prefer the possibility of fetching the whole role as an object instead. This would feel more natural.

@maurerle maurerle force-pushed the add_role_func_getter branch from eed41c7 to d84f8dc Compare March 4, 2025 10:06
@maurerle
Copy link
Collaborator Author

maurerle commented Mar 4, 2025

Yes you are right! I improved it to work correctly and return the first role implementing the expected class and added a test case.

The idea is to make it possible for roles of the same agent to interact with each other, without replacing two roles with a unified role (which would reduce the benefit of being able to use multiple roles in one agent)

@maurerle maurerle changed the title RFC: get_role_func helps to call functions of a different role of the same agent get_role helper to get access to a different role of the same agent Mar 4, 2025
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