Your AI-Powered Software Engineer β An asynchronous coding agent that autonomously understands codebases, plans solutions, and executes code changes across entire repositories.
UrAgent is a production-ready fork of Open SWE by LangChain, enhanced with enterprise features and improved reliability:
- Keycloak SSO β Seamless single sign-on integration for enterprise environments
- Auto Token Refresh β Automatic token renewal with secure cookie handling
- Public/Confidential Clients β Support for both Keycloak client types
- Gemini 3 Support β Full integration with Google's latest Gemini 3 models including thought signatures
- Multi-Provider Fallback β Automatic failover between OpenAI, Anthropic, and Google GenAI
- LiteLLM Gateway β Route requests through LiteLLM for unified API access
- Circuit Breaker Pattern β Intelligent model switching when providers fail
- Pattern Recognition β Detects verification loops, error retries, alternating patterns, and "chanting"
- Edit Loop Prevention β Specifically handles
str_replacefailures (whitespace, line endings) - Adaptive Thresholds β Tuned based on research from Claude Code, Gemini CLI, and Aider issues
- Graceful Recovery β Warns, escalates, or requests human help based on severity
- Provider Abstraction β Unified interface for E2B, Daytona, and local sandboxes
- Round-Robin Key Rotation β Weighted distribution across multiple API keys
- Multi-Provider Mode β Run sandboxes across different providers simultaneously
- Automatic Retry β Exponential backoff for transient sandbox failures
- GitHub API Caching β Intelligent caching layer for API responses
- Retry with Backoff β All external calls include retry logic
- Run Cancellation β Graceful termination with automatic commit
- LLM Comment Generation β Natural language PR/issue comments via AI
| Feature | Description |
|---|---|
| π Planning | Deep understanding of complex codebases with dedicated planning step |
| π€ Human in the Loop | Send messages while running for real-time feedback |
| π Parallel Execution | Run multiple tasks in parallel sandbox environments |
| π§βπ» End-to-End Management | Automatic GitHub issue and PR creation |
| π Enterprise SSO | Keycloak authentication for corporate environments |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js Web Application β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
β β Keycloak β β GitHub β β API Proxy + Cache β β
β β Auth β β OAuth β β (with retry & backoff) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LangGraph API (Internal) β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
β β Planner β β Programmer β β Reviewer β β
β β Graph β β Graph β β Graph β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β Model Manager ββ
β β β’ Multi-provider fallback (OpenAI β Anthropic β Google) ββ
β β β’ Circuit breaker pattern ββ
β β β’ Gemini 3 thought signatures ββ
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β Loop Detection ββ
β β β’ Verification loops β’ Error retries β’ Alternating patterns ββ
β β β’ Edit loops (str_replace) β’ Chanting detection ββ
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Sandbox Provider Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
β β E2B β β Daytona β β Local β β
β β Sandbox β β Sandbox β β (Dev Mode) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββββββ β
β β
β β’ Round-robin API key rotation β
β β’ Multi-provider mode β
β β’ Automatic retry with exponential backoff β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js 20+
- Yarn 3.5+
- Docker & Docker Compose
# Clone the repository git clone https://github.com/dongitran/UrAgent.git cd UrAgent # Install dependencies yarn install # Copy environment template cp apps/open-swe/.env.example apps/open-swe/.env cp apps/web/.env.example apps/web/.env
# Start the LangGraph API (Docker) docker compose up --build # In another terminal, start the web app cd apps/web && yarn dev
Visit http://localhost:3000 to access the UI.
# Primary provider (openai, anthropic, google-genai) LLM_PROVIDER=google-genai # Enable multi-provider fallback LLM_MULTI_PROVIDER_ENABLED=true # Provider-specific models (optional) GOOGLE_PROGRAMMER_MODEL=gemini-3-pro-preview GOOGLE_PLANNER_MODEL=gemini-3-pro-preview ANTHROPIC_PROGRAMMER_MODEL=claude-opus-4-5 OPENAI_PROGRAMMER_MODEL=gpt-4o # LiteLLM Gateway (optional) OPENAI_BASE_URL=https://your-litellm-gateway.com/v1
# Sandbox provider: e2b, daytona, multi, local SANDBOX_PROVIDER=daytona # For multi-provider mode with round-robin SANDBOX_PROVIDER=multi DAYTONA_API_KEYS=key1,key2,key3 DAYTONA_API_KEY_WEIGHTS=3,2,1
GITHUB_APP_ID=your-app-id GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----..." GITHUB_APP_NAME=your-app-name
DEFAULT_REPOSITORY_OWNER=your-org DEFAULT_REPOSITORY_NAME=your-repo DEFAULT_BRANCH=main DEFAULT_GITHUB_INSTALLATION_ID=your-installation-id
When Keycloak is configured, it becomes the mandatory authentication method.
NEXT_PUBLIC_KEYCLOAK_URL=https://your-keycloak.example.com NEXT_PUBLIC_KEYCLOAK_REALM=your-realm NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=your-client-id KEYCLOAK_REDIRECT_URI=http://localhost:3000/api/auth/keycloak/callback # Optional: Only for confidential clients # KEYCLOAK_CLIENT_SECRET=your-client-secret
Keycloak Client Setup:
- Create a new client in your Keycloak realm
- Set "Client authentication" to OFF for public clients (recommended for SPAs)
- Add
http://localhost:3000/api/auth/keycloak/callbackto Valid Redirect URIs - Add
http://localhost:3000to Web Origins
When Keycloak is not configured, GitHub OAuth is used automatically.
For local development without authentication:
DEFAULT_GITHUB_INSTALLATION_ID=your-installation-id DEFAULT_GITHUB_INSTALLATION_NAME=your-github-username
When deploying behind NGINX Ingress Controller, add these annotations for large authentication headers:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
UrAgent includes sophisticated loop detection based on research from:
- Claude Code Issue #4277 (Tool Call Loops + Content Loops)
- Gemini CLI Issue #11002 (Output comparison for false positive reduction)
- Gemini CLI Issue #5761 (str_replace_based_edit_tool specific errors)
- Cline Issue #2909 (Diff Edit Mismatch errors)
- Aider Issue #770 (Edit format errors)
Detected Patterns:
verificationβ Agent keeps reading same file to verifyerror_retryβ Agent retrying same command that errorsalternatingβ AβBβAβB patternedit_loopβ Agent stuck trying to edit same filechantingβ Model generating same content repeatedly
The Model Manager automatically handles provider failures:
Primary Model (e.g., Gemini 3 Pro)
β
βΌ (on failure)
Circuit Breaker Opens
β
βΌ
Fallback to Anthropic Claude
β
βΌ (on failure)
Fallback to OpenAI GPT-4
β
βΌ (after timeout)
Circuit Breaker Closes β Retry Primary
// Unified interface for all sandbox providers interface ISandboxProvider { name: string; createSandbox(options: CreateSandboxOptions): Promise<ISandbox>; getSandbox(id: string): Promise<ISandbox | null>; listSandboxes(): Promise<ISandbox[]>; } // Supported providers - E2B (Cloud sandboxes) - Daytona (Self-hosted) - Local (Development mode) - Multi (Round-robin across providers)
uragent/
βββ apps/
β βββ open-swe/ # LangGraph agent (Planner, Programmer, Reviewer)
β βββ web/ # Next.js 15 + React 19 frontend
β βββ cli/ # Command-line interface
β βββ docs/ # Documentation site
βββ packages/
β βββ shared/ # Shared utilities, types, constants
βββ docker-compose.yml # Local development setup
βββ langgraph.json # LangGraph configuration
βββ turbo.json # Turborepo build orchestration
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the same terms as the original Open SWE project.
Open SWE is created by LangChain and is licensed under the MIT License.
- LangChain for creating Open SWE
- LangGraph for the agent framework
- The open-source community for inspiration on loop detection and reliability patterns
Built with β€οΈ for developers who want AI that actually works