Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e54628b
fix: copy the async contextvar
Zhiyue-Wang Apr 21, 2026
4b4f7ef
fix: contextvars propagation in sync handlers and add SDK logging config
Zhiyue-Wang Apr 21, 2026
ad65d1f
feat: secure runtime binding with eth0 IP detection in Docker
Zhiyue-Wang Apr 22, 2026
ddb5c4a
feat: enable SSL verification by default with custom certificate support
Zhiyue-Wang Apr 22, 2026
fb44a97
fix: modify ssl for toolkit
Zhiyue-Wang Apr 22, 2026
3b1f30d
feature: update version dev
Zhiyue-Wang Apr 22, 2026
29e7776
fix: modify ssl verify
Zhiyue-Wang Apr 22, 2026
e702053
fix: adapt the server host
Zhiyue-Wang Apr 23, 2026
683dd7e
fix: modify iproute install in dockerfile
Zhiyue-Wang Apr 23, 2026
3f59663
feature: add request context for ping
Zhiyue-Wang Apr 23, 2026
84e3777
fix: add close method for memory client
Zhiyue-Wang Apr 23, 2026
3e807e1
fix: add projectid for metadata
Zhiyue-Wang Apr 23, 2026
812ca72
fix: modify stat host detect
Zhiyue-Wang Apr 23, 2026
94256a4
fix: add context clear
Zhiyue-Wang Apr 23, 2026
00acd51
feature: add userid for invoke cli
Zhiyue-Wang Apr 23, 2026
3e275c5
feature: modify dockerfile
Zhiyue-Wang Apr 23, 2026
674d99c
feature: adapt the start host
Zhiyue-Wang Apr 23, 2026
9293d0e
feature: modify default agent name
Zhiyue-Wang Apr 25, 2026
613a100
fix: fix the context test
Zhiyue-Wang Apr 27, 2026
85508f3
feature: adapt json format on windows
Zhiyue-Wang Apr 27, 2026
399ffdb
fix: modify tests
Zhiyue-Wang Apr 27, 2026
41526e6
fix: modif ut
Zhiyue-Wang Apr 27, 2026
9e031b3
fix: modify ut tests
Zhiyue-Wang Apr 27, 2026
469a8d4
fix: fix tests
Zhiyue-Wang Apr 27, 2026
ec2de1a
feature: publish version 0.1.1
Zhiyue-Wang May 7, 2026
a00d829
Merge branch 'main' into feature/runtime
Zhiyue-Wang May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 30 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ if __name__ == "__main__":
It is recommended to install the SDK in a virtual environment to avoid dependency conflicts.

**Windows:**

```powershell
# Create virtual environment
python -m venv venv
Expand All @@ -152,6 +153,7 @@ python -m venv venv
```

**Linux/macOS:**

```bash
# Create virtual environment
python -m venv venv
Expand All @@ -163,11 +165,13 @@ source venv/bin/activate
### Install via pip

**Windows:**

```powershell
pip install agentarts-sdk
```

**Linux/macOS:**

```bash
pip install agentarts-sdk
```
Expand All @@ -188,6 +192,7 @@ pip install agentarts-sdk[all]
### Install from Source

**Windows:**

```powershell
git clone https://github.com/huaweicloud/agentarts-sdk-python.git
cd agentarts-sdk-python
Expand All @@ -201,6 +206,7 @@ pip install -e ".[dev]"
```

**Linux/macOS:**

```bash
git clone https://github.com/huaweicloud/agentarts-sdk-python.git
cd agentarts-sdk-python
Expand All @@ -218,18 +224,21 @@ pip install -e ".[dev]"
Set environment variables for Huawei Cloud authentication:

**Windows (PowerShell):**

```powershell
$env:HUAWEICLOUD_SDK_AK = "your-access-key"
$env:HUAWEICLOUD_SDK_SK = "your-secret-key"
```

**Windows (Command Prompt):**

```cmd
set HUAWEICLOUD_SDK_AK=your-access-key
set HUAWEICLOUD_SDK_SK=your-secret-key
```

**Linux/macOS:**

```bash
export HUAWEICLOUD_SDK_AK="your-access-key"
export HUAWEICLOUD_SDK_SK="your-secret-key"
Expand All @@ -251,6 +260,7 @@ agentarts init -n my_agent -t langgraph
```

This creates:

```
my_agent/
├── agent.py # Agent implementation
Expand Down Expand Up @@ -307,16 +317,16 @@ agentarts destroy

## CLI Commands Reference

| Command | Description |
|---------|-------------|
| `agentarts init` | Initialize a new agent project |
| `agentarts dev` | Start local development server |
| `agentarts config` | Configure SDK settings (alias: `configure`) |
| `agentarts deploy` | Deploy agent to Huawei Cloud (alias: `launch`) |
| `agentarts invoke` | Invoke deployed agent |
| `agentarts status` | Check deployment status |
| `agentarts destroy` | Remove deployed agent |
| `agentarts mcp-gateway` | Manage MCP gateways |
| Command | Description |
| ----------------------- | ---------------------------------------------- |
| `agentarts init` | Initialize a new agent project |
| `agentarts dev` | Start local development server |
| `agentarts config` | Configure SDK settings (alias: `configure`) |
| `agentarts deploy` | Deploy agent to Huawei Cloud (alias: `launch`) |
| `agentarts invoke` | Invoke deployed agent |
| `agentarts status` | Check deployment status |
| `agentarts destroy` | Remove deployed agent |
| `agentarts mcp-gateway` | Manage MCP gateways |

## Limitations & Requirements

Expand All @@ -329,20 +339,22 @@ agentarts destroy

When using optional framework dependencies, ensure the following minimum versions:

| Framework | Minimum Version | Install Command |
|-----------|-----------------|-----------------|
| LangGraph | 1.0.0 | `pip install agentarts-sdk[langgraph]` |
| LangChain | 0.1.0 | `pip install agentarts-sdk[langchain]` |
| langchain-core | 0.1.0 | Included with langgraph/langchain |
| Framework | Minimum Version | Install Command |
| -------------- | --------------- | -------------------------------------- |
| LangGraph | 1.0.0 | `pip install agentarts-sdk[langgraph]` |
| LangChain | 0.1.0 | `pip install agentarts-sdk[langchain]` |
| langchain-core | 0.1.0 | Included with langgraph/langchain |

> **Note:** LangGraph 1.0+ introduces a new Checkpoint format with required fields (`step`, `pending_sends`, `parents`). The SDK's integration module is compatible with LangGraph 1.0 and above.

### Docker

Docker is required for:

- Building and deploying agents with `agentarts deploy` (alias: `launch`)

**Install Docker:**

- [Docker Desktop for Windows](https://www.docker.com/products/docker-desktop)
- [Docker Engine for Linux](https://docs.docker.com/engine/install/)

Expand Down Expand Up @@ -387,5 +399,6 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for det
## Support

- **Issues:** [GitHub Issues](https://github.com/huaweicloud/agentarts-sdk-python/issues)
- **Documentation:** https://docs.huaweicloud.com/agentarts
- **Email:** agentarts@huawei.com
- **Documentation:** <https://support.huaweicloud.com/productdesc-agentarts/agentarts_03_0002.html>
- **Email:** <hwagentartssdk@huawei.com>

64 changes: 64 additions & 0 deletions docs/cn/sdk_user_guide/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,45 @@ export HUAWEICLOUD_SDK_AGENTIDENTITY_ENDPOINT="https://agent-identity.cn-north-4

## 其他配置

### SDK 日志级别

用于控制 SDK 的日志输出级别:

| 环境变量 | 说明 | 默认值 |
|----------|------|--------|
| `AGENTARTS_LOG_LEVEL` | SDK 日志级别 | `INFO` |

**可选值:** `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`

**配置示例:**

```bash
# 开启详细日志(调试模式)
export AGENTARTS_LOG_LEVEL="DEBUG"

# 只显示警告及以上级别的日志
export AGENTARTS_LOG_LEVEL="WARNING"
```

**代码配置方式:**

```python
from agentarts.sdk.utils.logging import setup_logging

# 设置日志级别
setup_logging(level="DEBUG")

# 或使用环境变量(自动读取 AGENTARTS_LOG_LEVEL)
setup_logging()

# 自定义日志输出到文件
import logging
setup_logging(
level="DEBUG",
handler=logging.FileHandler("/var/log/agentarts/app.log")
)
```

### Python 基础镜像

用于指定 Agent 部署时的 Python 基础镜像:
Expand All @@ -224,6 +263,31 @@ export HUAWEICLOUD_SDK_AGENTIDENTITY_ENDPOINT="https://agent-identity.cn-north-4
export PYTHON_BASE_IMAGE="python:3.11-slim"
```

### 运行时监听地址

用于指定 Agent 运行时的监听地址:

| 环境变量 | 说明 | 默认值 |
|----------|------|--------|
| `AGENTARTS_BIND_IP` | 运行时监听地址 | Docker: 自动获取 eth0 IP,本地: `127.0.0.1` |

**默认行为:**

| 环境 | 默认监听地址 |
|------|-------------|
| Docker 容器 | 自动获取 eth0 接口 IP(通过 `ip addr show eth0`) |
| 本地开发 | `127.0.0.1` |

**配置示例:**

```bash
# 手动指定监听地址
export AGENTARTS_BIND_IP="0.0.0.0"

# 或在代码中指定
app.run(host="0.0.0.0", port=8080)
```

---

## 环境变量优先级说明
Expand Down
16 changes: 14 additions & 2 deletions docs/cn/toolkit_user_guide/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
| `--session` | `-s` | 会话 ID(用于有状态 Agent) | 自动生成 UUID |
| `--bearer-token` | `-bt` | Bearer 认证令牌 | 无 |
| `--timeout` | - | 请求超时时间(秒) | `900` |
| `--user-id` | `-u` | 用户 ID(用于 OAuth2 出站凭据) | 无 |

## 调用模式

Expand Down Expand Up @@ -118,13 +119,24 @@ agentarts invoke '{"message": "你好"}' --agent my-agent --bearer-token "your-t
agentarts invoke '{"message": "你好"}' --agent my-agent --endpoint custom-endpoint
```

### 示例 9: 设置超时时间
### 示例 10: 设置超时时间

```bash
agentarts invoke '{"message": "你好"}' --agent my-agent --timeout 60
```

### 示例 10: 复杂数据调用
### 示例 11: 使用用户 ID(OAuth2 出站凭据)

```bash
agentarts invoke '{"message": "你好"}' --agent my-agent --user-id "user-123"
```

或使用简写:
```bash
agentarts invoke '{"message": "你好"}' -a my-agent -u "user-123"
```

### 示例 12: 复杂数据调用

```bash
agentarts invoke '{
Expand Down
12 changes: 12 additions & 0 deletions docs/cn/toolkit_user_guide/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| `--bearer-token` | `-bt` | Bearer 认证令牌 | 无 |
| `--endpoint` | `-e` | 指定端点名称 | 无 |
| `--session` | `-s` | 会话 ID(用于有状态 Agent) | 无 |
| `--user-id` | `-u` | 用户 ID(用于 OAuth2 出站凭据) | 无 |

## 健康状态说明

Expand Down Expand Up @@ -144,6 +145,17 @@ agentarts status \
--bearer-token "your-token"
```

### 示例 9: 使用用户 ID(OAuth2 出站凭据)

```bash
agentarts status --agent my-agent --user-id "user-123"
```

或使用简写:
```bash
agentarts status -a my-agent -u "user-123"
```

## 检查模式

### Cloud 模式(默认)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "uv_build"

[project]
name = "agentarts-sdk"
version = "0.1.0"
version = "0.1.1"
description = "Huawei Cloud AgentArts SDK - Build, deploy and manage AI agents with cloud capabilities"
readme = "README.md"
license = {file = "LICENSE"}
Expand Down Expand Up @@ -45,8 +45,8 @@ dependencies = [
"huaweicloudsdkswr>=3.1.0",
"starlette>=0.46.2",
"uvicorn[standard]>=0.24.0",
"pydantic>=2.10.0",
"pydantic-settings>=2.6.0",
"pydantic>=2.0.0,<3.0.0",
"pydantic-settings>=2.0.0,<3.0.0",
"python-dotenv>=1.0.0",
"pyyaml>=6.0",
"requests>=2.31.0",
Expand Down
4 changes: 4 additions & 0 deletions src/agentarts/sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
warnings.filterwarnings("ignore", message="Unverified HTTPS request")
warnings.filterwarnings("ignore", category=urllib3.exceptions.InsecureRequestWarning)

from agentarts.sdk.utils.logging import setup_logging

setup_logging()

from agentarts import __author__, __version__
from agentarts.sdk.identity import (
IdentityClient,
Expand Down
9 changes: 8 additions & 1 deletion src/agentarts/sdk/integration/langgraph/saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class AgentArtsMemorySessionSaver(BaseCheckpointSaver):
falls back to HUAWEICLOUD_SDK_MEMORY_API_KEY environment variable)
max_messages: Maximum number of messages to retrieve per query, default 10
serde: Serializer/deserializer for checkpoints (default: JsonPlusSerializer)
verify_ssl: SSL verification setting (default: True). Can be:
- True: Verify SSL certificates using system CA bundle
- False: Skip SSL verification (not recommended for production)
- str: Path to custom CA certificate file
"""

def __init__(
Expand All @@ -108,6 +112,7 @@ def __init__(
api_key: str | None = None,
max_messages: int = 10,
serde: JsonPlusSerializer | None = None,
verify_ssl: bool | str = True,
) -> None:
if not LANGGRAPH_AVAILABLE:
msg = (
Expand All @@ -123,9 +128,11 @@ def __init__(
self._region = region or get_region()
self._api_key = api_key
self._max_messages = max_messages
self._verify_ssl = verify_ssl
self._client = MemoryClient(
region_name=self._region,
api_key=api_key
api_key=api_key,
verify_ssl=verify_ssl
)

@property
Expand Down
2 changes: 0 additions & 2 deletions src/agentarts/sdk/mcpgateway/mcp_gateway_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ class MCPGatewayClient(BaseHTTPClient):
"""

def __init__(self, config: RequestConfig | None = None):
# If config is None or base_url is not set, use control plane endpoint
if config is None or (config.base_url is None or config.base_url == ""):
from agentarts.sdk.service.http_client import RequestConfig
if config is None:
config = RequestConfig()
config.base_url = f"{get_control_plane_endpoint()}/v1/core"
config.verify_ssl = False
super().__init__(config, open_ak_sk=True)

def create_mcp_gateway(
Expand Down
7 changes: 5 additions & 2 deletions src/agentarts/sdk/memory/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(
self,
region_name: str | None = None,
api_key: str | None = None,
verify_ssl: bool = False,
verify_ssl: bool | str = True,
):
"""
Initialize Memory Client.
Expand All @@ -100,7 +100,10 @@ def __init__(
region_name: Huawei Cloud region name, auto-detected from environment if not provided
api_key: API Key for data plane authentication (optional, falls back
to HUAWEICLOUD_SDK_MEMORY_API_KEY environment variable)
verify_ssl: Whether to verify SSL certificates (default: False)
verify_ssl: SSL verification setting.
- True: Verify SSL certificates using system CA bundle (default)
- False: Skip SSL verification (not recommended for production)
- str: Path to custom CA certificate file

Environment Variables:
HUAWEICLOUD_SDK_AK: Access Key, required for control plane API
Expand Down
Loading
Loading