- uv cli and playwright is needed.
brew install uv
uv pip install playwright
uv run playwright install
-
Enable X Developer account. - Link. This will make you a new project and app.
-
Acquire credentials:
client_id
client_secret
- Install the required packages by running the following command in the terminal:
uv sync
- Export OpenAI credentials:
To make one, go to https://platform.openai.com/account/api-keys
export OPENAI_API_KEY=<your_openai_api_key>
- Run the following command to test if the agent is working:
uv run x_posting_agent/agent.py
If you have run this, you will see the .secrets.toml
file has been generated.
Add the X tokens to the .secrets.toml
file:
[auth.x]
client_id = "<your_client_id>"
client_secret = "<your_client_secret>"
Go to 01_x_posting_agent/x_posting_agent/agent.py#L55:
with PocketLangchain(
tools=[
# Add your tools here
#"https://github.com/vessl-ai/hyperpocket/tree/main/xxx",
],
You can add the following tools:
- create_post
- creates a post on X
- tool url: "https://github.com/vessl-ai/hyperpocket/tree/main/tools/x/create-post"
- list_home_posts_timeline"
- lists the home posts timeline for the id
- tool url: "https://github.com/vessl-ai/hyperpocket/tree/main/tools/x/list-home-posts-timeline"
- user_lookup_me
- looks up the authenticated user
- tool url: "https://github.com/vessl-ai/hyperpocket/tree/main/tools/x/user-lookup-me"
Run again and play with the agent.
You can see the list of Hyperpocket managed tools in https://github.com/vessl-ai/hyperpocket/tree/main/tools.
-
Create your directory as <TEAMNAME_AGENTNAME> and copy upper example(x_posting_agent) into it.
-
Tune system prompt and add tools to the agent.
-
Tool region is the same as the previous example.
- Run the agent and see the magic.
To add a custom tool, follow the docs https://vessl-ai.github.io/hyperpocket/tools/using-function-tools.html