Skip to content

Pi

A task-oriented walkthrough for working with Pi in beams.

Build with agents
On this page
Install the client tools and sign in

Beams is a Teleport project and uses official Teleport client tools.

The client tools include tsh to sign in and run commands, and tctl to administer your cluster if you have permission.

Cluster: example.beams.run. Edit this example to use your cluster name.

Install version 18.11.10 of the client:

Operating system
macOS

Download and open the macOS installer, then follow its instructions.

CLI
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkg
Linux

For Linux x86-64, download and install the client tools:

CLI
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/install
Windows

For Windows x86-64, run these commands in PowerShell. Add the extraction directory ($env:LOCALAPPDATA\Teleport) to your user PATH to use tsh in future terminals; the last command adds it to this terminal's PATH.

PowerShell
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"

Follow the official client tools install guide for other versions and architectures.

Check that you’re running v18.11.10 of the client with tsh version.

CLI
tsh version
Sign-in method
Passwordless

I sign in without a password (e.g. a passkey).

CLI
tsh login --proxy='example.beams.run' --auth=passwordless
Password & MFA

I have a password & MFA set up for my account:

Replace you@example.com with your Teleport username.

CLI
tsh login --proxy='example.beams.run' --user=you@example.com
SSO

I sign in with SSO (e.g. Okta, GitHub, SAML).

CLI
tsh login --proxy='example.beams.run'

Start a beam - a micro-VM. This beam starts with a pre-packaged and auto-updating Pi connected to an LLM inference endpoint:

CLI · Local terminal
tsh beams add

Start Pi in a managed session:

CLI · Inside the beam
# start pi in a background, and attach to it:
beamctl start --pty -- pi
# to detach, press Ctrl-Z, to reattach back use beamctl list and beamctl attach
Why not just run pi directly?

You can do this too, but the command above started pi in background, allocated terminal and attached to it. You can detach by typing Ctrl-Z, or close the tab, and reattach later:

CLI · Local terminal
tsh beams ssh <beam-name>

Find the Pi service ID, then reattach to it:

CLI · Inside the beam
beamctl list
beamctl attach <service-id>

You may need to recover your terminal if you got disconnected, some coding harnesses break it:

CLI · Inside the beam
stty sane
reset

Choosing a model

Teleport Beams offers several built-in models, once in pi harness, try this:

Text · Pi session
/models

Connect Pi to GitHub

Your agent uses GitHub through Teleport, so you never put a personal access token or SSH key in the beam. Teleport authorizes each git and tsh gh call and logs it in the audit log.

1. Connect your GitHub organization

Skip this step if tsh git ls already lists your organization. Otherwise, a Teleport admin with the editor role runs the following on a workstation with a browser, while signed in to GitHub as an owner of the organization. Replace my-org with your organization:

CLI · Admin terminal
tctl integrations github add --org=my-org --dry-run
tctl integrations github add --org=my-org

The dry run prints the plan without making changes. The second command creates the Teleport integration, opens your browser to create a GitHub App, and saves the app's credentials in Teleport. Install the app on Only select repositories, and choose the repositories your agent may work on. The agent can't reach any other repository. If the app name, which defaults to your cluster name, is taken on GitHub, add --app-name=my-org-teleport.

The command doesn't grant anyone access. Save this role as github-my-org.yaml:

YAML
kind: role
version: v8
metadata:
  name: github-my-org
spec:
  allow:
    github_permissions:
      - orgs: [my-org]

Create the role, and assign it to the people who run agents in beams through your usual role mapping:

CLI · Admin terminal
tctl create -f github-my-org.yaml

2. Authorize GitHub and start the beam

Sign in to GitHub through Teleport once from your workstation. This links your GitHub account to your Teleport user:

CLI · Local terminal
tsh git ls
tsh git login --github-org=my-org

tsh beams add shares this connected account with new beams by default. The agent then acts as your GitHub user, limited by both your GitHub permissions and the repositories you installed the app on. If you pass --roles, include github-my-org, or the beam can't see the organization:

CLI · Local terminal
tsh beams add --roles=beam-user,github-my-org

Don't pass --no-share-connected-accounts: that flag starts the beam without your GitHub authorization.

3. Check access from the beam

Inside the beam, confirm that the organization is listed and which GitHub account Teleport uses:

CLI · Inside the beam
tsh git ls
tsh gh --github-org=my-org -- api /user --jq .login

If tsh gh prints an authorization URL, open it on your workstation, finish signing in, and retry.

Ask Pi to work on a repository

You don’t need to configure Pi. Each beam has ~/AGENTS.md, which tells agents to clone with tsh git clone and to use tsh gh -- in place of gh. Pi loads it when you start Pi in your home directory or below. Start Pi and give it a task:

Text · Pi session
Clone https://github.com/my-org/my-repo, fix the typo in README.md on a new
branch, push it, and open a pull request.

The agent works with ordinary Git commands and tsh gh. Beams don't set a Git author, so ask the agent to set git config user.name and user.email in the checkout first, or include them in your prompt. A typical run looks like this:

CLI · Inside the beam
tsh git clone https://github.com/my-org/my-repo.git
cd my-repo
git switch -c fix-readme-typo
git commit -am 'Fix README typo'
git push -u origin HEAD
tsh gh --github-org=my-org -- pr create -R my-org/my-repo --fill

tsh git clone sets the remote to a teleport:// URL, so plain git fetch and git push keep going through Teleport. For a checkout that already exists in the beam, tell the agent to run tsh git config update in it first. The agent can't bypass branch protection or repository rules, so you still review and merge its pull requests.

See GitHub for SSH-only organizations, troubleshooting and audit events.

What’s next?

Further reading: Snapshots and Forks.

Search docs

Loading search and AI…

Skills

Install all available skills. All Beams and Teleport skills are hosted in our OSS Teleport repository.

npx skills add https://github.com/gravitational/teleport