RedditTools enables agents to interact with Reddit for browsing posts, comments, and subreddit information.
Example
The following agent can browse and analyze Reddit content:
1from kern.agent import Agent2from kern.tools.reddit import RedditTools34agent = Agent(5 instructions=[6 "You are a Reddit content analyst that helps explore and understand Reddit data",7 "Browse subreddits, analyze posts, and provide insights about discussions",8 "Respect Reddit's community guidelines and rate limits",9 "Provide clear summaries of Reddit content and trends",10 ],11 tools=[RedditTools()],12)1314agent.print_response("Show me the top posts from r/technology today", stream=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
reddit_instance | Optional[praw.Reddit] | None | Existing Reddit instance to use. |
client_id | Optional[str] | None | Reddit client ID. Uses REDDIT_CLIENT_ID if not set. |
client_secret | Optional[str] | None | Reddit client secret. Uses REDDIT_CLIENT_SECRET if not set. |
user_agent | Optional[str] | "RedditTools v1.0" | User agent string for API requests. |
username | Optional[str] | None | Reddit username for authenticated access. |
password | Optional[str] | None | Reddit password for authenticated access. |
Toolkit Functions
| Function | Description |
|---|---|
get_subreddit_info | Get information about a specific subreddit. |
get_subreddit_posts | Get posts from a subreddit with various sorting options. |
search_subreddits | Search for subreddits by name or topic. |
get_post_details | Get detailed information about a specific post. |
get_post_comments | Get comments from a specific post. |
search_posts | Search for posts across Reddit or within subreddits. |
get_user_info | Get information about a Reddit user. |
get_user_posts | Get posts submitted by a specific user. |
get_user_comments | Get comments made by a specific user. |
create_post | Create a new post (requires authentication). |
create_comment | Create a comment on a post (requires authentication). |
vote_on_post | Vote on a post (requires authentication). |
vote_on_comment | Vote on a comment (requires authentication). |
You can use include_tools or exclude_tools to modify the list of tools the agent has access to. Learn more about selecting tools.