Skip to content
Sign up
Get started

GitHub Action

Run Letta Code agents in your GitHub repository to handle issues, reviews, and more

The Letta Code GitHub Action lets you trigger Letta agents directly from GitHub issues and pull requests. Mention @letta-code in any comment to get help with code questions, implementation, and reviews.

  1. Get an API key from app.letta.com
  2. Add LETTA_API_KEY to your repository secrets
  3. Create .github/workflows/letta.yml:
name: Letta Code
on:
issue_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review_comment:
types: [created]
jobs:
letta:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: letta-ai/letta-code-action@v0
with:
letta_api_key: ${{ secrets.LETTA_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}

Now mention @letta-code in any issue or PR comment.

The action runs when explicitly triggered:

TriggerHow it works
MentionInclude @letta-code in a comment, issue body, or PR body
LabelAdd the letta-code label to an issue (configurable via label_trigger)
AssigneeAssign a specific user to an issue (configure via assignee_trigger)
PromptSet the prompt input for automated workflows

Replying to a comment without @letta-code will not trigger the action.

InputDescriptionDefault
letta_api_keyYour Letta API keyRequired
github_tokenGitHub token for API accessRequired
promptAuto-trigger with this promptNone
trigger_phrasePhrase that activates the agent@letta-code
modelModel to use (opus, sonnet-4.5, haiku, gpt-4.1)opus
assignee_triggerUsername that triggers when assignedNone
label_triggerLabel that triggers the actionletta-code
allowed_botsComma-separated bot usernames allowed to trigger (or *)None
allowed_non_write_usersUsers allowed without write permissionsNone

Pass arguments directly from your comment:

@letta-code [--model haiku] quick question about this code
@letta-code [--new] start with a fresh agent
@letta-code [--new --model sonnet-4.5] new agent with a specific model

Multiple flags can be combined in a single bracket.

The agent ID is stored in a hidden HTML comment in the tracking comment. On follow-up mentions, the action finds this metadata and resumes the same agent, preserving conversation history and memory.

To force a new agent, use: @letta-code [--new] start fresh

For workflows that run automatically (e.g., auto-review every PR):

on:
pull_request:
types: [opened]
jobs:
auto-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: letta-ai/letta-code-action@v0
with:
letta_api_key: ${{ secrets.LETTA_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: "Review this PR for bugs and security issues"

To have comments appear as your-app[bot] instead of github-actions[bot], use a GitHub App:

steps:
- uses: actions/checkout@v4
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: letta-ai/letta-code-action@v0
with:
letta_api_key: ${{ secrets.LETTA_API_KEY }}
github_token: ${{ steps.app-token.outputs.token }}

By default, only repository collaborators with write access can trigger the action. This prevents unauthorized users on public repos from consuming your API credits.

Use allowed_bots for bot users or allowed_non_write_users to allow specific usernames without write permissions (use with caution).

What it can do:

  • Read and search files in your repository
  • Make edits and create new files
  • Run shell commands (git, npm, etc.)
  • Commit and push changes
  • Create pull requests
  • Update its tracking comment with progress

What it can’t do:

  • Approve PRs (security restriction)
  • Modify workflow files (GitHub restriction)

Continue chatting with the same agent locally using Letta Code:

Terminal window
# Install
npm install -g @letta-ai/letta-code
# Resume the agent from GitHub
letta --agent agent-xxxxx

The agent ID is shown in every GitHub comment footer.

Agent not responding?

  • Check that LETTA_API_KEY is set in repository secrets
  • Verify the workflow has the required permissions
  • Look at the Actions tab for error logs

Wrong agent resumed?

  • Use @letta-code [--new] to force a fresh agent

Want to see what the agent is doing?

  • Click “View job run” in the comment footer
  • Enable show_full_output: true in your workflow for detailed logs