Documentation Index
Fetch the complete documentation index at: https://mintlify.com/21st-dev/1code/llms.txt
Use this file to discover all available pages before exploring further.
What are Background Agents?
Background agents run in isolated cloud sandboxes, allowing them to continue working even when you:- Close your laptop
- Lose internet connection temporarily
- Shut down your computer
- Switch to other tasks
Background agents require a Pro or Max subscription. Free and local installs run agents locally only.
How Background Agents Work
Cloud sandbox creation
When you start a background agent, 1Code:
- Spins up an isolated VM in the cloud
- Clones your repository
- Installs dependencies
- Sets up the development environment
Agent execution
The agent runs independently in the sandbox:
- Reads your code
- Executes commands
- Makes file changes
- Runs tests and builds
- Commits progress automatically
Live updates
You receive real-time updates:
- Message stream shows agent activity
- Git commits appear as they’re made
- Terminal output is captured
- File diffs are visible in the UI
Starting a Background Agent
From New Chat
Choose your repository
Background agents work best with repositories that have:
- A GitHub remote (for pushing changes)
- Well-defined setup scripts
- Automated tests
- Clear build processes
Pick agent and model
Both Claude Code and Codex support background mode:
- Claude Code: Better for complex, multi-file changes
- Codex: Faster for targeted fixes
Write your prompt
Be more detailed than usual since you won’t be available for clarifications:Good background prompts:
- “Upgrade all dependencies to their latest compatible versions, run tests after each major upgrade, and fix any breaking changes”
- “Refactor the entire API layer to use async/await instead of callbacks, maintaining backwards compatibility”
- “Fix all ESLint errors in the project by updating code (not disabling rules), and ensure tests still pass”
- Expected behavior
- Testing requirements
- Rollback conditions
- PR description template
Converting Local to Background
You can convert an existing local chat to background:- Open the chat you want to move to background
- Click the three-dot menu in the header
- Select Move to Background
- Confirm the migration
Monitoring Background Agents
Desktop App
The chat interface shows real-time updates: Status indicators:- 🔵 Provisioning: Sandbox is being created
- 🟢 Running: Agent is actively working
- 🟡 Idle: Waiting for user input or external trigger
- 🔴 Failed: Encountered an error
- ⚪ Completed: Task finished successfully
- Message stream updates in real-time
- Git operations appear with badges
- Terminal output scrolls as it’s captured
- File diffs load as changes are made
Mobile PWA
Access background agents from your phone:- Visit
https://1code.devon mobile - Log in with your account
- Tap Install when prompted (saves to home screen)
- View all active agents on the dashboard
- Tap any agent to see progress and logs
- Push notifications for key events
- Quick status overview
- Ability to pause or stop agents
- Read-only access to logs and diffs
Notifications
Background agents send notifications for:- ✅ Task completion
- ❌ Errors or failures
- ❓ Questions needing your input
- 🔀 Pull requests created
- ⏸️ Agent paused waiting for approval
Managing Background Agents
Pausing and Resuming
Pause an agent:- Open the background chat
- Click Pause in the header
- Agent stops after current task completes
- Sandbox remains active (you’re billed for compute time)
- Click Resume in the header
- Agent continues from where it paused
Stopping Agents
Graceful stop:- Click the three-dot menu
- Select Stop Agent
- Agent finishes current operation
- Commits work-in-progress
- Sandbox shuts down
- Hold
Shiftwhile clicking Stop - Agent terminates immediately
- WIP may be lost
- Use only if agent is stuck
Following Up
Send additional messages to running agents:- Type your message in the input
- Press Send
- Message is queued and processed in order
- “Also update the documentation”
- “Run the test suite again”
- “Create the PR now”
- “Cancel this task and start over”
Live Browser Previews
For web projects, background agents provide live browser previews:Automatic detection
1Code detects common dev servers:
npm run devornpm startyarn devoryarn startpython manage.py runserverrails server- Custom commands from
package.json
Port forwarding
Dev server ports are automatically forwarded:
- Secure HTTPS tunnel created
- Public URL generated
- Link appears in chat
Opening the preview
Click the preview link in chat:
- Opens in your default browser
- URL is unique to your session
- Automatically refreshes on changes
- React, Vue, Svelte, Angular
- Next.js, Nuxt, SvelteKit
- Django, Flask, FastAPI
- Rails, Laravel, Express
- Any HTTP server on standard ports
Best Practices
Detailed Prompts
Provide comprehensive instructions since you won’t be available to clarify. Include success criteria and rollback conditions.
Automated Tests
Ensure your project has tests. Background agents use them to verify changes work correctly.
Small Iterations
Break large tasks into smaller background agents. Easier to debug and recover if something fails.
Monitor Progress
Check in periodically via desktop or mobile. Catch issues early before the agent goes too far down the wrong path.
When to Use Background Agents
Perfect for:- Large refactoring projects (multi-hour)
- Dependency upgrades across many packages
- Test suite fixes (hundreds of failing tests)
- Codebase-wide changes (rename, restructure)
- CI/CD pipeline fixes
- Documentation generation
- Quick one-file changes
- Tasks requiring frequent human input
- Highly exploratory work
- Changes you need immediately
Troubleshooting
Sandbox provisioning failed
Sandbox provisioning failed
Cause: Infrastructure issue or invalid configuration.Solution:
- Retry the operation (transient failures are common)
- Check your subscription status at 1code.dev/account
- Verify repository is accessible from the cloud
- If persistent, contact support with the error ID
Agent can't access private repository
Agent can't access private repository
Cause: GitHub permissions not granted.Solution:
- Go to Settings > Integrations > GitHub
- Click Reconnect
- Grant access to the required repositories
- Retry the background agent creation
Background agent is slow
Background agent is slow
Cause: Heavy dependencies, large repository, or limited resources.Solution:
- Upgrade to Max plan for more powerful sandboxes
- Optimize setup scripts to cache dependencies
- Use shallow clones for large repositories
- Add
.1code/background-setup.shfor optimized background setup
Agent stopped with no error
Agent stopped with no error
Cause: Likely hit timeout, resource limit, or billing issue.Solution:
- Check the last few messages for clues
- Review execution time - may have hit plan limits
- Check billing status
- Download logs: Click three-dot menu > Download Logs
Can't see live updates
Can't see live updates
Cause: WebSocket connection issue or browser tab inactive.Solution:
- Refresh the page
- Check browser console for WebSocket errors
- Try a different browser
- Disable browser extensions that might block connections
- Check firewall/network settings
Preview URL not working
Preview URL not working
Cause: Dev server not running or port not detected.Solution:
- Check agent’s terminal output for server startup
- Verify dev server is running on standard port (3000, 8000, etc.)
- Manual port forwarding: Send message “expose port 3000”
- Check firewall rules in sandbox aren’t blocking
Pricing and Limits
Background agents are metered by compute time. See current rates at 1code.dev/pricing.
| Plan | Concurrent Agents | Max Runtime | Sandbox Size |
|---|---|---|---|
| Free | 0 | - | - |
| Pro | 3 | 4 hours | 2 vCPU, 4GB RAM |
| Max | 10 | 8 hours | 4 vCPU, 8GB RAM |
- Charged per minute of active compute time
- Paused agents don’t consume credits (but sandbox stays warm)
- Stopped agents release resources immediately
- Monthly compute credits with rollover
API Access
Run background agents programmatically via API:Next Steps
Automations
Trigger background agents automatically from GitHub, Linear, or Slack.
API Reference
Run agents programmatically via the 1Code API.
Mobile PWA
Install the mobile app to monitor agents on the go.
Pricing
Learn about background agent pricing and limits.