Take Trailhead Learning beyond the browser
Salesforce Trailhead is a great way to learn Agentforce. You can level up this experience by connecting your Trailhead org to Salesforce CLI and working with AgentScript metadata locally in VS Code. Here’s a quick setup flow for connecting a Trailhead Agentforce org to Salesforce CLI 👇
Prerequisites:
• VS Code
• Salesforce CLI installed
• Trailhead org with Agentforce enabled
Step 1. Open your Trailhead org
Launch the Trailhead playground or developer org that you want to connect.
Step 2. Find your username
Profile → Settings
Step 3. Set password (if not set already)
Settings → Change My Password
Step 4. Connect org via CLI
Authenticate via browser, setting up alias for the org and providing your Trailhead org url:
# Authenticate with your Trailhead org
sf org login web --alias your-org-alias --instance-url https://your-org-name.develop.my.salesforce.com
Step 5. Verify connection
Confirm that the org was added successfully:
sf org list
Step 6. Set the default org
To avoid specifying the org in every command, set it as the default target:
sf config set target-org your-org-alias
Important: Use the Correct Login URL
Trailhead org URLs used for login usually look like:
https://your-org-name.develop.my.salesforce.com
NOT:
• login.salesforce.com
• develop.lightning.force.com
Once connected, you can retrieve AgentScript metadata locally in VS Code, experiment faster, and work with Agentforce in a more development-oriented workflow.

























