Skip to content

Commit 8a3d3d1

Browse files
docs: fix agent-server Client SDK section with actual API (OpenHands#496)
* docs: fix agent-server Client SDK section with actual API Replace non-existent AgentServerClient documentation with actual SDK usage. The previous documentation referenced a 'Client SDK' with AgentServerClient class that does not exist. This update replaces it with: - OpenHandsCloudWorkspace for OpenHands Cloud integration - APIRemoteWorkspace for custom runtime environments - RemoteConversation which is the actual API for remote agent execution Fixes OpenHands#495 Co-authored-by: openhands <openhands@all-hands.dev> * docs: refactor to architecture-focused content per review feedback - Replace usage examples with architecture diagram and pattern explanation - Add workspace types table showing dispatch behavior - Document RemoteConversation responsibilities - Link to existing guides for complete working examples Addresses review feedback about architecture docs focusing on design patterns rather than tutorial-style usage instructions. Co-authored-by: openhands <openhands@all-hands.dev> * docs: add GitHub source links to component names Per sdk-arch-guidelines.md, link every component name to its source file. Co-authored-by: openhands <openhands@all-hands.dev> --------- Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 54d4326 commit 8a3d3d1

1 file changed

Lines changed: 34 additions & 26 deletions

File tree

sdk/arch/agent-server.mdx

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -368,39 +368,47 @@ curl https://agent-server.example.com/health
368368
- Resource exhaustion
369369
- Container failures
370370

371-
## Client SDK
371+
## Client Integration Architecture
372372

373-
Python SDK for interacting with Agent Server:
373+
The SDK implements a **workspace-based dispatch pattern** for connecting to agent servers. The `Conversation` factory inspects the workspace type and returns the appropriate conversation implementation.
374374

375-
```python
376-
from openhands.client import AgentServerClient
375+
```mermaid
376+
flowchart LR
377+
Conv["Conversation()"] --> Check{"Workspace Type?"}
378+
Check -->|LocalWorkspace| Local["LocalConversation"]
379+
Check -->|RemoteWorkspace| Remote["RemoteConversation"]
380+
Remote -->|HTTP/WebSocket| Server["Agent Server"]
381+
382+
style Conv fill:#f3e8ff,stroke:#7c3aed,stroke-width:2px
383+
style Remote fill:#e8f3ff,stroke:#2b6cb0,stroke-width:2px
384+
style Server fill:#fff4df,stroke:#b7791f,stroke-width:2px
385+
```
377386

378-
client = AgentServerClient(
379-
url="https://agent-server.example.com",
380-
api_key="your-api-key"
381-
)
387+
### Workspace Types
382388

383-
# Create conversation
384-
conversation = client.create_conversation()
389+
| Workspace | Conversation Type | Communication |
390+
|-----------|------------------|---------------|
391+
| [`LocalWorkspace`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/workspace/local.py) | [`LocalConversation`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py) | Direct execution |
392+
| [`OpenHandsCloudWorkspace`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-workspace/openhands/workspace/cloud/workspace.py) | [`RemoteConversation`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/conversation/impl/remote_conversation.py) | HTTPS + WebSocket to OpenHands Cloud |
393+
| [`APIRemoteWorkspace`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-workspace/openhands/workspace/remote_api/workspace.py) | [`RemoteConversation`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/conversation/impl/remote_conversation.py) | HTTPS + WebSocket to Runtime API |
394+
| [`DockerWorkspace`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-workspace/openhands/workspace/docker/workspace.py) | [`RemoteConversation`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/conversation/impl/remote_conversation.py) | HTTP + WebSocket to local container |
385395

386-
# Send message
387-
response = client.send_message(
388-
conversation_id=conversation.id,
389-
message="Hello, agent!"
390-
)
396+
### [`RemoteConversation`](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/conversation/impl/remote_conversation.py) Responsibilities
391397

392-
# Stream responses
393-
for event in client.stream_conversation(conversation.id):
394-
if event.type == "message":
395-
print(event.content)
396-
```
398+
The `RemoteConversation` implementation handles all client-server concerns:
399+
400+
- **Session management**: Authenticates and maintains connection to agent server
401+
- **Event streaming**: WebSocket connection for real-time agent events
402+
- **Request routing**: HTTP calls for conversation lifecycle operations
403+
- **Reconnection**: Automatic retry logic for transient failures
404+
405+
### Usage Examples
406+
407+
For complete working examples with all required setup:
397408

398-
**Client handles**:
399-
- Authentication
400-
- Request/response serialization
401-
- Error handling
402-
- Streaming
403-
- Retries
409+
- **[OpenHands Cloud Workspace](/sdk/guides/agent-server/cloud-workspace)** - Managed cloud infrastructure
410+
- **[API-based Sandbox](/sdk/guides/agent-server/api-sandbox)** - Custom runtime environments
411+
- **[Docker Sandbox](/sdk/guides/agent-server/docker-sandbox)** - Local containerized execution
404412

405413
## Cost Considerations
406414

0 commit comments

Comments
 (0)