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.- Click Connect GitHub in the setup wizard
- Select which repositories the app can access (all or specific ones)
- 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.- Go to the Anthropic Console and create an API key
- Paste it into the setup wizard
- Click Save API Key
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.- Click Set Up Environment in the wizard
- Select a GitHub repository from the dropdown
- Choose the branch to base changes on (defaults to
main) - 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
- Setup script — commands to run after cloning (e.g.,
- 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.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.
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
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.