> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/reddit.md).

# reddit

[Reddit](https://www.reddit.com/) is a social platform where users share and discuss content in topic-based communities called subreddits.

In Agent Forge, you can use the Reddit integration to:

* **Get Posts**: Retrieve posts from any subreddit, with options to sort (Hot, New, Top, Rising) and filter Top posts by time (Day, Week, Month, Year, All Time).
* **Get Comments**: Fetch comments from a specific post, with options to sort and set the number of comments.

These operations let your agents access and analyze Reddit content as part of your automated workflows.

### Usage Instructions

Integrate Reddit into workflows. Read posts, comments, and search content. Submit posts, vote, reply, edit, and manage your Reddit account.

### Tools

#### `reddit_get_posts`

Fetch posts from a subreddit with different sorting options

**Input**

| Parameter   | Type    | Required | Description                                                                                   |
| ----------- | ------- | -------- | --------------------------------------------------------------------------------------------- |
| `subreddit` | string  | Yes      | The name of the subreddit to fetch posts from (without the r/ prefix)                         |
| `sort`      | string  | No       | Sort method for posts: "hot", "new", "top", or "rising" (default: "hot")                      |
| `limit`     | number  | No       | Maximum number of posts to return (default: 10, max: 100)                                     |
| `time`      | string  | No       | Time filter for "top" sorted posts: "day", "week", "month", "year", or "all" (default: "day") |
| `after`     | string  | No       | Fullname of a thing to fetch items after (for pagination)                                     |
| `before`    | string  | No       | Fullname of a thing to fetch items before (for pagination)                                    |
| `count`     | number  | No       | A count of items already seen in the listing (used for numbering)                             |
| `show`      | string  | No       | Show items that would normally be filtered (e.g., "all")                                      |
| `sr_detail` | boolean | No       | Expand subreddit details in the response                                                      |

**Output**

| Parameter   | Type   | Description                                                                 |
| ----------- | ------ | --------------------------------------------------------------------------- |
| `subreddit` | string | Name of the subreddit where posts were fetched from                         |
| `posts`     | array  | Array of posts with title, author, URL, score, comments count, and metadata |

#### `reddit_get_comments`

Fetch comments from a specific Reddit post

**Input**

| Parameter   | Type    | Required | Description                                                                                                          |
| ----------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `postId`    | string  | Yes      | The ID of the Reddit post to fetch comments from                                                                     |
| `subreddit` | string  | Yes      | The subreddit where the post is located (without the r/ prefix)                                                      |
| `sort`      | string  | No       | Sort method for comments: "confidence", "top", "new", "controversial", "old", "random", "qa" (default: "confidence") |
| `limit`     | number  | No       | Maximum number of comments to return (default: 50, max: 100)                                                         |
| `depth`     | number  | No       | Maximum depth of subtrees in the thread (controls nested comment levels)                                             |
| `context`   | number  | No       | Number of parent comments to include                                                                                 |
| `showedits` | boolean | No       | Show edit information for comments                                                                                   |
| `showmore`  | boolean | No       | Include "load more comments" elements in the response                                                                |
| `showtitle` | boolean | No       | Include submission title in the response                                                                             |
| `threaded`  | boolean | No       | Return comments in threaded/nested format                                                                            |
| `truncate`  | number  | No       | Integer to truncate comment depth                                                                                    |
| `after`     | string  | No       | Fullname of a thing to fetch items after (for pagination)                                                            |
| `before`    | string  | No       | Fullname of a thing to fetch items before (for pagination)                                                           |
| `count`     | number  | No       | A count of items already seen in the listing (used for numbering)                                                    |

**Output**

| Parameter | Type   | Description                                                         |
| --------- | ------ | ------------------------------------------------------------------- |
| `post`    | object | Post information including ID, title, author, content, and metadata |

#### `reddit_get_controversial`

Fetch controversial posts from a subreddit

**Input**

| Parameter   | Type    | Required | Description                                                                                            |
| ----------- | ------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `subreddit` | string  | Yes      | The name of the subreddit to fetch posts from (without the r/ prefix)                                  |
| `time`      | string  | No       | Time filter for controversial posts: "hour", "day", "week", "month", "year", or "all" (default: "all") |
| `limit`     | number  | No       | Maximum number of posts to return (default: 10, max: 100)                                              |
| `after`     | string  | No       | Fullname of a thing to fetch items after (for pagination)                                              |
| `before`    | string  | No       | Fullname of a thing to fetch items before (for pagination)                                             |
| `count`     | number  | No       | A count of items already seen in the listing (used for numbering)                                      |
| `show`      | string  | No       | Show items that would normally be filtered (e.g., "all")                                               |
| `sr_detail` | boolean | No       | Expand subreddit details in the response                                                               |

**Output**

| Parameter   | Type   | Description                                                                               |
| ----------- | ------ | ----------------------------------------------------------------------------------------- |
| `subreddit` | string | Name of the subreddit where posts were fetched from                                       |
| `posts`     | array  | Array of controversial posts with title, author, URL, score, comments count, and metadata |

#### `reddit_search`

Search for posts within a subreddit

**Input**

| Parameter     | Type    | Required | Description                                                                                            |
| ------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `subreddit`   | string  | Yes      | The name of the subreddit to search in (without the r/ prefix)                                         |
| `query`       | string  | Yes      | Search query text                                                                                      |
| `sort`        | string  | No       | Sort method for search results: "relevance", "hot", "top", "new", or "comments" (default: "relevance") |
| `time`        | string  | No       | Time filter for search results: "hour", "day", "week", "month", "year", or "all" (default: "all")      |
| `limit`       | number  | No       | Maximum number of posts to return (default: 10, max: 100)                                              |
| `restrict_sr` | boolean | No       | Restrict search to the specified subreddit only (default: true)                                        |
| `after`       | string  | No       | Fullname of a thing to fetch items after (for pagination)                                              |
| `before`      | string  | No       | Fullname of a thing to fetch items before (for pagination)                                             |
| `count`       | number  | No       | A count of items already seen in the listing (used for numbering)                                      |
| `show`        | string  | No       | Show items that would normally be filtered (e.g., "all")                                               |

**Output**

| Parameter   | Type   | Description                                                                               |
| ----------- | ------ | ----------------------------------------------------------------------------------------- |
| `subreddit` | string | Name of the subreddit where search was performed                                          |
| `posts`     | array  | Array of search result posts with title, author, URL, score, comments count, and metadata |

#### `reddit_submit_post`

Submit a new post to a subreddit (text or link)

**Input**

| Parameter      | Type    | Required | Description                                                  |
| -------------- | ------- | -------- | ------------------------------------------------------------ |
| `subreddit`    | string  | Yes      | The name of the subreddit to post to (without the r/ prefix) |
| `title`        | string  | Yes      | Title of the submission (max 300 characters)                 |
| `text`         | string  | No       | Text content for a self post (markdown supported)            |
| `url`          | string  | No       | URL for a link post (cannot be used with text)               |
| `nsfw`         | boolean | No       | Mark post as NSFW                                            |
| `spoiler`      | boolean | No       | Mark post as spoiler                                         |
| `send_replies` | boolean | No       | Send reply notifications to inbox (default: true)            |

**Output**

| Parameter | Type    | Description                                      |
| --------- | ------- | ------------------------------------------------ |
| `success` | boolean | Whether the post was submitted successfully      |
| `message` | string  | Success or error message                         |
| `data`    | object  | Post data including ID, name, URL, and permalink |

#### `reddit_vote`

Upvote, downvote, or unvote a Reddit post or comment

**Input**

| Parameter | Type   | Required | Description                                                                 |
| --------- | ------ | -------- | --------------------------------------------------------------------------- |
| `id`      | string | Yes      | Thing fullname to vote on (e.g., t3\_xxxxx for post, t1\_xxxxx for comment) |
| `dir`     | number | Yes      | Vote direction: 1 (upvote), 0 (unvote), or -1 (downvote)                    |

**Output**

| Parameter | Type    | Description                     |
| --------- | ------- | ------------------------------- |
| `success` | boolean | Whether the vote was successful |
| `message` | string  | Success or error message        |

#### `reddit_save`

Save a Reddit post or comment to your saved items

**Input**

| Parameter  | Type   | Required | Description                                                              |
| ---------- | ------ | -------- | ------------------------------------------------------------------------ |
| `id`       | string | Yes      | Thing fullname to save (e.g., t3\_xxxxx for post, t1\_xxxxx for comment) |
| `category` | string | No       | Category to save under (Reddit Gold feature)                             |

**Output**

| Parameter | Type    | Description                     |
| --------- | ------- | ------------------------------- |
| `success` | boolean | Whether the save was successful |
| `message` | string  | Success or error message        |

#### `reddit_unsave`

**Input**

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |

**Output**

| Parameter   | Type   | Description      |
| ----------- | ------ | ---------------- |
| `subreddit` | string | Subreddit name   |
| `posts`     | json   | Posts data       |
| `post`      | json   | Single post data |
| `comments`  | json   | Comments data    |

#### `reddit_reply`

Add a comment reply to a Reddit post or comment

**Input**

| Parameter   | Type   | Required | Description                                                                  |
| ----------- | ------ | -------- | ---------------------------------------------------------------------------- |
| `parent_id` | string | Yes      | Thing fullname to reply to (e.g., t3\_xxxxx for post, t1\_xxxxx for comment) |
| `text`      | string | Yes      | Comment text in markdown format                                              |

**Output**

| Parameter | Type    | Description                                          |
| --------- | ------- | ---------------------------------------------------- |
| `success` | boolean | Whether the reply was posted successfully            |
| `message` | string  | Success or error message                             |
| `data`    | object  | Comment data including ID, name, permalink, and body |

#### `reddit_edit`

Edit the text of your own Reddit post or comment

**Input**

| Parameter  | Type   | Required | Description                                                              |
| ---------- | ------ | -------- | ------------------------------------------------------------------------ |
| `thing_id` | string | Yes      | Thing fullname to edit (e.g., t3\_xxxxx for post, t1\_xxxxx for comment) |
| `text`     | string | Yes      | New text content in markdown format                                      |

**Output**

| Parameter | Type    | Description                     |
| --------- | ------- | ------------------------------- |
| `success` | boolean | Whether the edit was successful |
| `message` | string  | Success or error message        |
| `data`    | object  | Updated content data            |

#### `reddit_delete`

Delete your own Reddit post or comment

**Input**

| Parameter | Type   | Required | Description                                                                |
| --------- | ------ | -------- | -------------------------------------------------------------------------- |
| `id`      | string | Yes      | Thing fullname to delete (e.g., t3\_xxxxx for post, t1\_xxxxx for comment) |

**Output**

| Parameter | Type    | Description                         |
| --------- | ------- | ----------------------------------- |
| `success` | boolean | Whether the deletion was successful |
| `message` | string  | Success or error message            |

#### `reddit_subscribe`

Subscribe or unsubscribe from a subreddit

**Input**

| Parameter   | Type   | Required | Description                                                     |
| ----------- | ------ | -------- | --------------------------------------------------------------- |
| `subreddit` | string | Yes      | The name of the subreddit (without the r/ prefix)               |
| `action`    | string | Yes      | Action to perform: "sub" to subscribe or "unsub" to unsubscribe |

**Output**

| Parameter | Type    | Description                                    |
| --------- | ------- | ---------------------------------------------- |
| `success` | boolean | Whether the subscription action was successful |
| `message` | string  | Success or error message                       |

### Notes

* Category: `tools`
* Type: `reddit`
