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

Better X Agent configuration e.g. no retweets, likes etc #1813

Closed
jaycoolslm opened this issue Jan 4, 2025 · 31 comments
Closed

Better X Agent configuration e.g. no retweets, likes etc #1813

jaycoolslm opened this issue Jan 4, 2025 · 31 comments
Labels
enhancement New feature or request

Comments

@jaycoolslm
Copy link

Is your feature request related to a problem? Please describe.

Currently I have an X agent however it is very spammy. Just replies and reacts to irrelevant content. I just want it to post a relatively frequently e.g. twice an hour

Describe the solution you'd like

Ideally, a configurable architecture where the X agent can be adjusted (e.g. through env vars or a config.json) along with a section of docs to specify where and how to use.

at minimum, some docs addressing where in the source code to edit

Describe alternatives you've considered

Asked the discord (other people have same issue) + a highlevel dive into the src code

@jaycoolslm jaycoolslm added the enhancement New feature or request label Jan 4, 2025
Copy link
Contributor

github-actions bot commented Jan 4, 2025

Hello @jaycoolslm! Welcome to the ai16z community. Thank you for opening your first issue; we appreciate your contribution. You are now a ai16z contributor!

@salacoste
Copy link

found the same problem, interval did nothing in terms of timing.

@prince981620
Copy link

same issue leading account to get flagged , rate limit and even banned.

@jaycoolslm
Copy link
Author

Okay, think I've found the issue.

by default, the env var ENABLE_ACTION_PROCESSING=false

this gets rendered as a string which is truthy

therefore, this block of code in https://github.com/elizaOS/eliza/blob/main/packages/client-twitter/src/post.ts

        // Add check for ENABLE_ACTION_PROCESSING before starting the loop
        const enableActionProcessing =
            this.runtime.getSetting("ENABLE_ACTION_PROCESSING") ?? false;

        if (enableActionProcessing) {
            processActionsLoop().catch((error) => {
                elizaLogger.error(
                    "Fatal error in process actions loop:",
                    error
                );
            });
        } else {
            elizaLogger.log("Action processing loop disabled by configuration");
        }

actually runs the processActionsLoop by default.

Quick solution is to delete false in the env var ie:

ENABLE_ACTION_PROCESSING= # empty value

@jaycoolslm
Copy link
Author

Better solution would be to have a src code which correctly parses the false string

I can PR an implementation but it may not be consistent with other potential implementations that have been handled... so will hold off for now

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

Okay, think I've found the issue.

by default, the env var ENABLE_ACTION_PROCESSING=false

this gets rendered as a string which is truthy

therefore, this block of code in https://github.com/elizaOS/eliza/blob/main/packages/client-twitter/src/post.ts

        // Add check for ENABLE_ACTION_PROCESSING before starting the loop
        const enableActionProcessing =
            this.runtime.getSetting("ENABLE_ACTION_PROCESSING") ?? false;

        if (enableActionProcessing) {
            processActionsLoop().catch((error) => {
                elizaLogger.error(
                    "Fatal error in process actions loop:",
                    error
                );
            });
        } else {
            elizaLogger.log("Action processing loop disabled by configuration");
        }

actually runs the processActionsLoop by default.

Quick solution is to delete false in the env var ie:

ENABLE_ACTION_PROCESSING= # empty value

Thanks for pointing this out! I'll take a closer look. Much appreciated. 🙏

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@jaycoolslm hi I just checked the latest branch code, and it seems to work as expected. Maybe you could try upgrading to the latest version? Let me know if the issue persists!

@y4my4my4m
Copy link
Contributor

@tcm390 the env does work as expected but it's not respecting the ACTION_INTERVAL at all. It just constantly does a tweet after tweet, mentioning, RT, non-stop.

@jaycoolslm
Copy link
Author

@jaycoolslm hi I just checked the latest branch code, and it seems to work as expected. Maybe you could try upgrading to the latest version? Let me know if the issue persists!

just pulled and checked out to latest release branch. @elizaos/plugin-aptos#build is causing my build to fail unfortunately.

Will try a fresh clone

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@jaycoolslm hi I just checked the latest branch code, and it seems to work as expected. Maybe you could try upgrading to the latest version? Let me know if the issue persists!

just pulled and checked out to latest release branch. @elizaos/plugin-aptos#build is causing my build to fail unfortunately.

Will try a fresh clone

try this

pnpm clean

pnpm install -r --no-frozen-lockfile

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@tcm390 the env does work as expected but it's not respecting the ACTION_INTERVAL at all. It just constantly does a tweet after tweet, mentioning, RT, non-stop.

checking

@jaycoolslm
Copy link
Author

@jaycoolslm hi I just checked the latest branch code, and it seems to work as expected. Maybe you could try upgrading to the latest version? Let me know if the issue persists!

just pulled and checked out to latest release branch. @elizaos/plugin-aptos#build is causing my build to fail unfortunately.
Will try a fresh clone

try this

pnpm clean

pnpm install -r --no-frozen-lockfile

Same thing. I've cloned a fresh repo and aptos still failing

can you try cloning from fresh and checking out to latest relase?

@jaycoolslm
Copy link
Author

deleting plugin-aptos fixes it

@jaycoolslm
Copy link
Author

@tcm390 latest release branch parses the env var correctly. Thanks for flagging it up

@y4my4my4m
Copy link
Contributor

@jaycoolslm @tcm390 are you guys not having the issue that it's just constantly tweeting though? regardless of the ACTION_INTERVAL ?

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@tcm390 latest release branch parses the env var correctly. Thanks for flagging it up

np 😊

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@jaycoolslm @tcm390 are you guys not having the issue that it's just constantly tweeting though? regardless of the ACTION_INTERVAL ?

I think it’s waiting for the ACTION_INTERVAL, but there might be too many actions to process within a single interval. Maybe I need to make the number of actions per interval configurable.

@y4my4my4m
Copy link
Contributor

@tcm390 right now all it's doing is just finding random account based on a topic (bitcoin for example), replying to it, retweeting something else, replying to someone else, etc.
Every 5~10 seconds (as fast as openai processes it i guess), forever, despite it being left at the default 5minutes

I'm not sure if it's just an issue of the number of actions per interval...perhaps though, but it doesn't seem that way.

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

@tcm390 right now all it's doing is just finding random account based on a topic (bitcoin for example), replying to it, retweeting something else, replying to someone else, etc. Every 5~10 seconds (as fast as openai processes it i guess), forever, despite it being left at the default 5minutes

I'm not sure if it's just an issue of the number of actions per interval...perhaps though, but it doesn't seem that way.

Thanks for pointing this out! I'm taking a look. Thank you 🙏

@y4my4my4m
Copy link
Contributor

@tcm390 im not sure if it makes a difference but i noticed that behaviour when i had no targetted users defined

@alwaysabetterway
Copy link

I have the same issue, once ENABLE_ACTION_PROCESSING is enabled, it goes bananas retweeting and replying to everything from the timeline.

I modified

const homeTimeline = await this.client.fetchTimelineForActions(15); 

to 1 and it still does the same

I'm looking a bit closer, GPT found some issues but they were all irrelevant.

@alwaysabetterway
Copy link

also I guess the fetchTimelineForActions is not respecting the TWITTER_TARGET_USERS

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

think it’s waiting for the ACTION_INTERVAL, but there might be too many actions to process within a single interval. Maybe I need to make the number of actions per interval configurable.

yes it's fetching your home timeline

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

I have the same issue, once ENABLE_ACTION_PROCESSING is enabled, it goes bananas retweeting and replying to everything from the timeline.

I modified

const homeTimeline = await this.client.fetchTimelineForActions(15); 

to 1 and it still does the same

I'm looking a bit closer, GPT found some issues but they were all irrelevant.

yes it's a bug I also just aware

made an issue: elizaOS/agent-twitter-client#43

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

I have the same issue, once ENABLE_ACTION_PROCESSING is enabled, it goes bananas retweeting and replying to everything from the timeline.

I modified

const homeTimeline = await this.client.fetchTimelineForActions(15); 

to 1 and it still does the same

I'm looking a bit closer, GPT found some issues but they were all irrelevant.

I'm considering something like this: https://github.com/elizaOS/eliza/pull/1824/files

Fetch the top timelines, randomly shuffle them, and within each interval, perform only the limited actions defined by the MAX_ACTIONS_PROCESSING environment variable. 🤔 Hmm... I'm not sure if this is the best solution.

@alwaysabetterway
Copy link

I have the same issue, once ENABLE_ACTION_PROCESSING is enabled, it goes bananas retweeting and replying to everything from the timeline.
I modified

const homeTimeline = await this.client.fetchTimelineForActions(15); 

to 1 and it still does the same
I'm looking a bit closer, GPT found some issues but they were all irrelevant.

I'm considering something like this: https://github.com/elizaOS/eliza/pull/1824/files

Fetch the top timelines, randomly shuffle them, and within each interval, perform only the limited actions defined by the MAX_ACTIONS_PROCESSING environment variable. 🤔 Hmm... I'm not sure if this is the best solution.

This is a good solution for now I think, it def creates more activity other than the defined usernames to follow which feels a bit more natural to me.

@alwaysabetterway
Copy link

alwaysabetterway commented Jan 4, 2025

I have the same issue, once ENABLE_ACTION_PROCESSING is enabled, it goes bananas retweeting and replying to everything from the timeline.
I modified

const homeTimeline = await this.client.fetchTimelineForActions(15); 

to 1 and it still does the same
I'm looking a bit closer, GPT found some issues but they were all irrelevant.

I'm considering something like this: https://github.com/elizaOS/eliza/pull/1824/files

Fetch the top timelines, randomly shuffle them, and within each interval, perform only the limited actions defined by the MAX_ACTIONS_PROCESSING environment variable. 🤔 Hmm... I'm not sure if this is the best solution.

I guess it's also important to note that ACTION_INTERVAL is now in minutes and not miliseconds in your changes right?

I'm testing it now, so far it's not going crazy posting, I'll leave it running over night with moderate settings.

so far no issues 👏

["◎ Selected tweet from xxx: gm"]
["◎ Finished checking Twitter interactions"]
["◎ Successfully posted reply tweet"]
["◎ Processed 1 tweets"]
["◎ Next action processing scheduled in 15 minutes"]

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

I guess it's also important to note that ACTION_INTERVAL is now in minutes and not miliseconds in your changes right?

I'm testing it now, so far it's not going crazy posting, I'll leave it running over night with moderate settings.

Actually, ACTION_INTERVAL was already in minutes originally. 😊

@alwaysabetterway
Copy link

I guess it's also important to note that ACTION_INTERVAL is now in minutes and not miliseconds in your changes right?
I'm testing it now, so far it's not going crazy posting, I'll leave it running over night with moderate settings.

Actually, ACTION_INTERVAL was already in minutes originally. 😊

ohh ok, mine was in milliseconds, maybe outdated .env file thnx

@tcm390
Copy link
Collaborator

tcm390 commented Jan 4, 2025

I'm considering something like this: https://github.com/elizaOS/eliza/pull/1824/files

Fetch the top timelines, randomly shuffle them, and within each interval, perform only the limited actions defined by the >MAX_ACTIONS_PROCESSING environment variable. 🤔 Hmm... I'm not sure if this is the best solution.

@odilitime gave me an excellent suggestion; I’ll work on it tonight.

Screenshot 2025-01-04 at 3 38 43 PM

@tcm390
Copy link
Collaborator

tcm390 commented Jan 6, 2025

This PR resolves issue #1824 by implementing the following changes:

Two new environment variables have been introduced:

MAX_ACTIONS_PROCESSING: Defines the maximum number of actions (e.g., retweets, likes) to process in a single cycle. This helps prevent excessive or uncontrolled actions.

ACTION_TIMELINE_TYPE: Specifies the type of timeline to interact with. Available options are "foryou" or "following", with the default being "foryou" (home timelines).

Please let me know if this resolves the issue or if anyone encounters any further problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants