Skip to main content

Prerequisites

  • A Magnet account at magnet.run
  • A GitHub account with at least one repository
  • An Anthropic API key (get one here)

Setup

When you first navigate to Sessions, Magnet walks you through a three-step setup wizard. You only need to do this once.

Step 1: Connect GitHub

Install the Magnet GitHub App on your GitHub account or organization. This lets the agent clone your repositories and open pull requests.
  1. Click Connect GitHub in the setup wizard
  2. Select which repositories the app can access (all or specific ones)
  3. Approve the permissions

Step 2: Add your Anthropic API key

Magnet uses your own Anthropic API key to run Claude Code in sessions. This key is stored securely and used for all sessions in your organization.
  1. Go to the Anthropic Console and create an API key
  2. Paste it into the setup wizard
  3. Click Save API Key
You can update your API key later in Settings > Sandbox.

Step 3: Create an environment

An environment defines how the sandbox is configured for your sessions — which repository to clone, what setup commands to run, and how to start a dev server.
  1. Click Set Up Environment in the wizard
  2. Select a GitHub repository from the dropdown
  3. Choose the branch to base changes on (defaults to main)
  4. Optionally configure:
    • Setup script — commands to run after cloning (e.g., pnpm install)
    • Run script — start a dev server (e.g., pnpm dev)
    • Preview port — the port your dev server listens on, for live preview
    • Environment variables — any secrets or config your project needs
  5. Click Create Environment
See Environments for a full guide on configuring environments.

Launch your first session

Once setup is complete, you’re ready to create sessions.
1

Open the Sessions page

Navigate to Sessions in the sidebar.
2

Create a new session

Type a prompt describing the task you want the agent to do. For example:
Add input validation to the signup form. Email should be validated, and passwords need at least 8 characters.
Select which environment to use (if you have more than one), then send.
3

Watch the agent work

The session opens a real-time view where you can see the agent:
  • Think through the problem
  • Read and edit files
  • Run commands
  • Make commits
4

Review the pull request

When the agent finishes, it opens a PR on GitHub. You can review the diff in Magnet or directly on GitHub.

Next steps

Environments

Learn how to configure environments for your projects.

Sessions Overview

Deep dive into how sessions work.

GitHub Integration

Learn more about the GitHub integration.

MCP Server

Connect your coding tools to Magnet.