Skip to content

Commit 3cc7816

Browse files
committed
docs: add inline GitHub source links per guidelines (agent-server.mdx)\n\nCo-authored-by: openhands <openhands@all-hands.dev>
1 parent f077784 commit 3cc7816

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

sdk/arch/agent-server.mdx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Source: [`openhands-agent-server/`](https://github.com/OpenHands/software-agent-
1111

1212
The server provides:
1313

14-
1. **Conversation lifecycle API** - Create, run, pause, delete conversations (source: openhands/agent_server/conversation_router.py)
15-
2. **Event access** - Search, count, get, batch-get conversation events; WebSocket event streaming (source: openhands/agent_server/event_router.py, openhands/agent_server/sockets.py)
16-
3. **Execution utilities** - Start and monitor bash commands; file upload/download; simple Git ops (source: openhands/agent_server/bash_router.py, file_router.py, git_router.py)
17-
4. **Tool registry listing** - Introspect available tools on the server (source: openhands/agent_server/tool_router.py)
18-
5. **Server details** - Health, alive, and server info endpoints (source: openhands/agent_server/server_details_router.py)
14+
1. **Conversation lifecycle API** - Create, run, pause, delete conversations ([conversation_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/conversation_router.py))
15+
2. **Event access** - Search, count, get, batch-get conversation events; WebSocket event streaming ([event_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/event_router.py), [sockets.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/sockets.py))
16+
3. **Execution utilities** - Start and monitor bash commands; file upload/download; simple Git ops ([bash_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/bash_router.py), [file_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/file_router.py), [git_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/git_router.py))
17+
4. **Tool registry listing** - Introspect available tools on the server ([tool_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/tool_router.py))
18+
5. **Server details** - Health, alive, and server info endpoints ([server_details_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/server_details_router.py))
1919

2020
## Architecture
2121

@@ -57,13 +57,13 @@ flowchart TB
5757
```
5858

5959
- App construction and route wiring happen in [`api.py`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-agent-server/openhands/agent_server/api.py): the app mounts a single `/api` router that includes conversation, event, tool, bash, git, file, vscode, and desktop routers.
60-
- Event and VSCode/Desktop services are initialized in the lifespan context (source: openhands/agent_server/api.py).
60+
- Event and VSCode/Desktop services are initialized in the lifespan context ([api.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/api.py)).
6161

6262
## Authentication
6363

64-
- HTTP requests: header `X-Session-API-Key` if session keys are configured (source: openhands/agent_server/dependencies.py, `create_session_api_key_dependency`)
65-
- WebSocket: query parameter `session_api_key` (source: openhands/agent_server/dependencies.py, sockets.py)
66-
- Configuration source: environment-driven `Config` (source: openhands/agent_server/config.py)
64+
- HTTP requests: header `X-Session-API-Key` if session keys are configured ([dependencies.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/dependencies.py))
65+
- WebSocket: query parameter `session_api_key` ([dependencies.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/dependencies.py), [sockets.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/sockets.py))
66+
- Configuration source: environment-driven `Config` ([config.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/config.py))
6767

6868
```mermaid
6969
flowchart LR
@@ -75,7 +75,7 @@ flowchart LR
7575

7676
All REST endpoints are mounted under `/api` unless noted.
7777

78-
- Conversations (source: openhands/agent_server/conversation_router.py)
78+
- Conversations ([conversation_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/conversation_router.py))
7979
- `GET /api/conversations/search` – list
8080
- `GET /api/conversations/count` – count
8181
- `GET /api/conversations/{conversation_id}` – get
@@ -91,43 +91,43 @@ All REST endpoints are mounted under `/api` unless noted.
9191
- `POST /api/conversations/{id}/security_analyzer` – set analyzer
9292
- `POST /api/conversations/{id}/ask_agent` – question-only (no state change)
9393

94-
- Events (source: openhands/agent_server/event_router.py)
94+
- Events ([event_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/event_router.py))
9595
- `GET /api/conversations/{conversation_id}/events/search`
9696
- `GET /api/conversations/{conversation_id}/events/count`
9797
- `GET /api/conversations/{conversation_id}/events/{event_id}`
9898
- `GET /api/conversations/{conversation_id}/events?event_ids=...`
9999
- `POST /api/conversations/{conversation_id}/events` – send `Message`
100100

101-
- Bash (source: openhands/agent_server/bash_router.py)
101+
- Bash ([bash_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/bash_router.py))
102102
- `POST /api/bash/start_bash_command`
103103
- `POST /api/bash/execute_bash_command`
104104
- `GET /api/bash/bash_events/search|{event_id}|` (list/get)
105105
- `DELETE /api/bash/bash_events` – clear
106106

107-
- Files (source: openhands/agent_server/file_router.py)
107+
- Files ([file_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/file_router.py))
108108
- `POST /api/file/upload/{path}` – upload to absolute path
109109
- `GET /api/file/download/{path}` – download absolute path
110110
- `GET /api/file/download-trajectory/{conversation_id}` – zip state
111111

112-
- Git (source: openhands/agent_server/git_router.py)
112+
- Git ([git_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/git_router.py))
113113
- `GET /api/git/changes/{path}`
114114
- `GET /api/git/diff/{path}`
115115

116-
- Tools (source: openhands/agent_server/tool_router.py)
116+
- Tools ([tool_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/tool_router.py))
117117
- `GET /api/tools/` – list registered tools
118118

119-
- Server details (source: openhands/agent_server/server_details_router.py)
119+
- Server details ([server_details_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/server_details_router.py))
120120
- `GET /alive`, `GET /health`, `GET /server_info`
121121

122-
- WebSockets (source: openhands/agent_server/sockets.py)
122+
- WebSockets ([sockets.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/sockets.py))
123123
- `WS /sockets/events/{conversation_id}?session_api_key=...&resend_all=bool`
124124
- `WS /sockets/bash-events?session_api_key=...&resend_all=bool`
125125

126126
## Design Notes
127127

128-
- The server itself does not manage Docker containers. Containerization and lifecycle are handled by workspace implementations such as `DockerWorkspace` in the `openhands-workspace` package, which run this server inside the container and connect via HTTP (source: openhands-workspace/openhands/workspace/docker/workspace.py).
129-
- Request/response models are Pydantic classes in `models.py` (source: openhands/agent_server/models.py).
130-
- Security: schema-level API key checks, path validation for file ops (absolute path enforcement), and typed payloads (sources: dependencies.py, file_router.py).
128+
- The server itself does not manage Docker containers. Containerization and lifecycle are handled by workspace implementations such as `DockerWorkspace` in the `openhands-workspace` package, which run this server inside the container and connect via HTTP ([docker/workspace.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-workspace/openhands/workspace/docker/workspace.py)).
129+
- Request/response models are Pydantic classes in `models.py` ([models.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/models.py)).
130+
- Security: schema-level API key checks, path validation for file ops (absolute path enforcement), and typed payloads ([dependencies.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/dependencies.py), [file_router.py](https://github.com/OpenHands/software-agent-sdk/blob/HEAD/openhands-agent-server/openhands/agent_server/file_router.py)).
131131

132132
## Component Relationships
133133

0 commit comments

Comments
 (0)