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

feat: Optimize Agent Action Processing by Prioritizing Timelines and Limiting Actions Per Cycle #1824

Merged
merged 10 commits into from
Jan 6, 2025

Conversation

tcm390
Copy link
Collaborator

@tcm390 tcm390 commented Jan 4, 2025

related:
#1813 (comment)
#1813 (comment)
#1813 (comment)

Problem:
Many users reported that after enabling action processing, the agent was excessively retweeting, liking, and performing other actions indiscriminately. This leading account to get flagged, rate limit and even banned. This behavior occurred because, in each cycle, we fetch 30–40 home timelines and process actions for all of them without prioritization.

Additionally, the fetchTimeline method of the agent-twitter-client is currently ignoring the count parameter, leading to unnecessarily large data fetches. elizaOS/agent-twitter-client#43

Solution in This PR:
Instead of processing all timelines in each cycle, timelines are now sorted by the LLM decision scores.
The timelines are spliced to limit the number of processed actions based on the MAX_ACTIONS_PROCESSING environment variable.

@tcm390 tcm390 marked this pull request as draft January 4, 2025 19:53
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
packages/core/src/types.ts 89.88% <100.00%> (+0.35%) ⬆️

@y4my4my4m
Copy link
Contributor

@tcm390
what does MAX_ACTIONS_PROCESSING do? It's max action every X minutes?
Should probably add it to .env.example with some description

@tcm390
Copy link
Collaborator Author

tcm390 commented Jan 5, 2025

@tcm390 what does MAX_ACTIONS_PROCESSING do? It's max action every X minutes? Should probably add it to .env.example with some description

yea will do. Thanks for reminding 😊

@tcm390 tcm390 marked this pull request as ready for review January 5, 2025 13:48
@tcm390 tcm390 changed the title add MAX_ACTIONS_PROCESSING variable Optimize Agent Action Processing by Prioritizing Timelines and Limiting Actions Per Cycle Jan 5, 2025
@y4my4my4m
Copy link
Contributor

@tcm390 thank you for the work, much appreciated.

A suggestion/addedum since you're working in this area, would it be simple add a bool for which kind of timeline to interact with in the action loop? Afaik by default it's fetching from the "For you" and it gets random users that X recommends but it would be nice to only interact with the people the agent follows too.

Screenshot_20250107_001444

@tcm390
Copy link
Collaborator Author

tcm390 commented Jan 6, 2025

@tcm390 thank you for the work, much appreciated.

A suggestion/addedum since you're working in this area, would it be simple add a bool for which kind of timeline to interact with in the action loop? Afaik by default it's fetching from the "For you" and it gets random users that X recommends but it would be nice to only interact with the people the agent follows too.

Thanks for the suggestion! I’ve updated the code to include a boolean for selecting the timeline type. Could you kindly test it and let me know if it works? Appreciate your feedback!

@shakkernerd shakkernerd changed the title Optimize Agent Action Processing by Prioritizing Timelines and Limiting Actions Per Cycle feat: Optimize Agent Action Processing by Prioritizing Timelines and Limiting Actions Per Cycle Jan 6, 2025
@shakkernerd shakkernerd changed the base branch from main to develop January 6, 2025 16:55
Copy link
Member

@shakkernerd shakkernerd left a comment

Choose a reason for hiding this comment

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

Looks good!

@shakkernerd shakkernerd merged commit 4c53ea2 into develop Jan 6, 2025
7 checks passed
@shakkernerd shakkernerd deleted the tcm-max-actions branch January 6, 2025 17:11
@y4my4my4m
Copy link
Contributor

@tcm390 im late but it seems to work, thank you :)

@y4my4my4m y4my4my4m mentioned this pull request Jan 7, 2025
@tcm390
Copy link
Collaborator Author

tcm390 commented Jan 7, 2025

@tcm390 im late but it seems to work, thank you :)

Glad to hear that! Thanks for testing it. 🙏

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.

3 participants