Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
703 changes: 675 additions & 28 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"src/agent-client-protocol-conductor",
"src/agent-client-protocol-cookbook",
"src/agent-client-protocol-derive",
"src/agent-client-protocol-http",
"src/agent-client-protocol-rmcp",
"src/agent-client-protocol-test",
"src/agent-client-protocol-trace-viewer",
Expand All @@ -23,6 +24,7 @@ homepage = "https://github.com/agentclientprotocol/rust-sdk"
agent-client-protocol = { path = "src/agent-client-protocol", version = "0.11.1" }
agent-client-protocol-conductor = { path = "src/agent-client-protocol-conductor", version = "0.11.1" }
agent-client-protocol-derive = { path = "src/agent-client-protocol-derive", version = "0.11.0" }
agent-client-protocol-http = { path = "src/agent-client-protocol-http", version = "0.11.1" }
agent-client-protocol-rmcp = { path = "src/agent-client-protocol-rmcp", version = "0.11.1" }
agent-client-protocol-test = { path = "src/agent-client-protocol-test" }
agent-client-protocol-trace-viewer = { path = "src/agent-client-protocol-trace-viewer", version = "0.11.0" }
Expand Down Expand Up @@ -57,6 +59,9 @@ clap = { version = "4.5", features = ["derive"] }

# HTTP
axum = "0.8"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
eventsource-stream = "0.2"
url = "2.5"
async-process = "2"
async-stream = "0.3.6"
blocking = "1"
Expand Down
4 changes: 4 additions & 0 deletions md/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- [Design Overview](./design.md)
- [Protocol Reference](./protocol.md)

# Transports

- [HTTP / WebSocket Transport](./http-transport.md)

# Conductor (agent-client-protocol-conductor)

- [Conductor Design](./conductor.md)
Expand Down
36 changes: 36 additions & 0 deletions md/http-transport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# HTTP / WebSocket Transport

`agent-client-protocol-http` exposes ACP agents over one `/acp` endpoint.

- `POST /acp` with `initialize` creates a connection and returns `Acp-Connection-Id`.
- Later `POST /acp` requests include `Acp-Connection-Id`; session-scoped requests also include `Acp-Session-Id` or `params.sessionId`.
- `GET /acp` with `Accept: text/event-stream` streams agent messages over SSE.
- `GET /acp` with a WebSocket upgrade uses text frames for JSON-RPC messages.
- `DELETE /acp` tears down the connection.

## Server

```rust
use agent_client_protocol_http::AcpHttpServer;

let app = AcpHttpServer::new(|| my_agent()).into_router();
let listener = tokio::net::TcpListener::bind("127.0.0.1:8080").await?;
axum::serve(listener, app).await?;
```

## Client

```rust
use agent_client_protocol_http::HttpClient;

let transport = HttpClient::new("http://127.0.0.1:8080")?;
my_client().connect_to(transport).await?;
```

The same `HttpClient` also speaks WebSocket — pass a `ws://` or `wss://` URL
and it will open a single bidirectional connection instead of using POST + SSE:

```rust
let transport = HttpClient::new("ws://127.0.0.1:8080")?;
my_client().connect_to(transport).await?;
```
3 changes: 3 additions & 0 deletions md/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The `agent-client-protocol` crate includes a [`concepts`](https://docs.rs/agent-
src/
├── agent-client-protocol/ # Core protocol SDK
├── agent-client-protocol-tokio/ # Tokio utilities (process spawning)
├── agent-client-protocol-http/ # HTTP/SSE/WebSocket transport
├── agent-client-protocol-rmcp/ # Integration with rmcp crate
├── agent-client-protocol-cookbook/ # Usage patterns (rendered as rustdoc)
├── agent-client-protocol-derive/ # Proc macros
Expand All @@ -37,11 +38,13 @@ src/
graph TD
acp[agent-client-protocol<br/>Core SDK]
tokio[agent-client-protocol-tokio<br/>Process spawning]
http[agent-client-protocol-http<br/>HTTP/SSE/WebSocket transport]
rmcp[agent-client-protocol-rmcp<br/>rmcp integration]
conductor[agent-client-protocol-conductor<br/>Proxy orchestration]
cookbook[agent-client-protocol-cookbook<br/>Usage patterns]

tokio --> acp
http --> acp
rmcp --> acp
conductor --> acp
conductor --> tokio
Expand Down
6 changes: 6 additions & 0 deletions src/agent-client-protocol-http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## [Unreleased]

### Added
- HTTP/SSE/WebSocket transport for ACP agents
44 changes: 44 additions & 0 deletions src/agent-client-protocol-http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "agent-client-protocol-http"
version = "0.11.1"
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
description = "HTTP and WebSocket transport for the Agent Client Protocol (ACP)"
keywords = ["acp", "agent", "protocol", "http", "websocket"]
categories = ["development-tools", "web-programming::http-server"]

[dependencies]
agent-client-protocol.workspace = true
jsonrpcmsg.workspace = true

futures.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["sync", "rt", "macros", "time"] }
tokio-util.workspace = true
tracing.workspace = true
thiserror.workspace = true

# Server
axum = { workspace = true, features = ["ws", "macros"] }
tower-http = { version = "0.6", features = ["cors"] }
async-stream = { workspace = true }
uuid = { workspace = true }

# Client
reqwest = { workspace = true, features = ["stream"] }
eventsource-stream = { workspace = true }
url = { workspace = true }
tokio-tungstenite = "0.29"

[dev-dependencies]
agent-client-protocol = { workspace = true }
agent-client-protocol-test.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing-subscriber.workspace = true

[lints]
workspace = true
8 changes: 8 additions & 0 deletions src/agent-client-protocol-http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# agent-client-protocol-http

HTTP/WebSocket transport for ACP agents.

- **Server**: `AcpHttpServer` exposes agents over HTTP + SSE with optional WebSocket upgrade
- **Client**: `HttpClient` connects to remote agents over HTTP + SSE

See the [documentation](https://docs.rs/agent-client-protocol-http) for usage examples.
Loading