mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 13:52:43 +08:00
Adds support for enterprise LLM gateways through TOML configuration files,
enabling OpenHands CLI usage in corporate environments with custom API
management solutions.
Features:
- Load gateway configuration from TOML file via --gateway-config flag
- Support for environment variable OPENHANDS_GATEWAY_CONFIG
- Environment variable expansion in config values (${ENV:VAR_NAME})
- Comprehensive example configuration file with documentation
- Clean separation from interactive setup flow
Implementation:
- Added gateway_config.py module for loading and parsing TOML configs
- Thread gateway config through CLI entry to agent initialization
- Apply gateway settings when creating LLM instance
- Update tests to handle new gateway_config_path parameter
- Remove interactive gateway setup to keep UI simple
This enables enterprise customers to configure:
- OAuth2/token authentication with identity providers
- Custom headers for routing and authorization
- Request body parameters for compliance/monitoring
- All without impacting the standard user experience
Note: Requires openhands-sdk>=1.0.0a6 once the SDK PR is merged.
Currently set to >=1.0.0a4 for compatibility.
109 lines
2.6 KiB
TOML
109 lines
2.6 KiB
TOML
[build-system]
|
|
build-backend = "hatchling.build"
|
|
requires = [ "hatchling>=1.25" ]
|
|
|
|
[project]
|
|
name = "openhands"
|
|
version = "1.0.2"
|
|
description = "OpenHands CLI - Terminal User Interface for OpenHands AI Agent"
|
|
readme = "README.md"
|
|
license = { text = "MIT" }
|
|
authors = [ { name = "OpenHands Team", email = "contact@all-hands.dev" } ]
|
|
requires-python = ">=3.12"
|
|
classifiers = [
|
|
"Programming Language :: Python :: 3 :: Only",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
]
|
|
# Using Git URLs for dependencies so installs from PyPI pull from GitHub
|
|
# TODO: pin package versions once agent-sdk has published PyPI packages
|
|
dependencies = [
|
|
"fastapi>=0.120.2",
|
|
"openhands-sdk>=1.0.0a4",
|
|
"openhands-tools>=1.0.0a3",
|
|
"prompt-toolkit>=3",
|
|
"typer>=0.17.4",
|
|
"uvicorn>=0.38.0",
|
|
]
|
|
|
|
scripts = { openhands = "openhands_cli.simple_main:main" }
|
|
|
|
[dependency-groups]
|
|
# Hatchling wheel target: include the package directory
|
|
dev = [
|
|
"black>=23",
|
|
"flake8>=6",
|
|
"gevent>=24.2.1,<26",
|
|
"isort>=5",
|
|
"mypy>=1",
|
|
"pre-commit>=4.3",
|
|
"pyinstaller>=6.15",
|
|
"pytest>=8.4.1",
|
|
"pytest-cov>=6",
|
|
"pytest-forked>=1.6",
|
|
"pytest-xdist>=3.6.1",
|
|
"ruff>=0.11.8",
|
|
]
|
|
|
|
[tool.hatch.metadata]
|
|
allow-direct-references = true
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = [ "openhands_cli" ]
|
|
|
|
# uv source pins for internal packages
|
|
|
|
[tool.black]
|
|
line-length = 88
|
|
target-version = [ "py312" ]
|
|
|
|
[tool.ruff]
|
|
target-version = "py312"
|
|
line-length = 88
|
|
|
|
format.indent-style = "space"
|
|
format.quote-style = "double"
|
|
format.line-ending = "auto"
|
|
format.skip-magic-trailing-comma = false
|
|
lint.select = [
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"E", # pycodestyle errors
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"UP", # pyupgrade
|
|
"W", # pycodestyle warnings
|
|
]
|
|
lint.ignore = [
|
|
"B008", # calls in argument defaults
|
|
"C901", # too complex
|
|
"E501", # line too long (black handles)
|
|
]
|
|
|
|
[tool.isort]
|
|
profile = "black"
|
|
line_length = 88
|
|
|
|
[tool.coverage.run]
|
|
relative_files = true
|
|
omit = [ "tests/*", "**/test_*" ]
|
|
|
|
[tool.coverage.paths]
|
|
source = [
|
|
"openhands_cli/",
|
|
"openhands-cli/openhands_cli/",
|
|
]
|
|
|
|
[tool.mypy]
|
|
python_version = "3.12"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
disallow_untyped_defs = true
|
|
ignore_missing_imports = true
|
|
|
|
# UNCOMMENT TO USE EXACT COMMIT FROM AGENT-SDK
|
|
|
|
# [tool.uv.sources]
|
|
# openhands-sdk = { git = "https://github.com/All-Hands-AI/agent-sdk.git", subdirectory = "openhands-sdk", rev = "512399d896521aee3131eea4bb59087fb9dfa243" }
|
|
# openhands-tools = { git = "https://github.com/All-Hands-AI/agent-sdk.git", subdirectory = "openhands-tools", rev = "512399d896521aee3131eea4bb59087fb9dfa243" }
|