Skip to main content

Module serve

Module serve 

Source
Expand description

Server startup helpers.

Reduces the ~25 lines of hyper boilerplate typically needed to start an A2A HTTP server down to a single function call.

§Example

use std::sync::Arc;
use a2a_protocol_server::serve::serve;
use a2a_protocol_server::dispatch::JsonRpcDispatcher;
use a2a_protocol_server::RequestHandlerBuilder;

let handler = Arc::new(
    RequestHandlerBuilder::new(MyExecutor)
        .build()
        .expect("build handler"),
);

let dispatcher = JsonRpcDispatcher::new(handler);
serve("127.0.0.1:3000", dispatcher).await?;

Structs§

ServeConfig
Limits applied to a Server.
ServeReport
What the socket layer did, and whether it finished.
Server
A bound listener that has not started accepting yet.

Constants§

DEFAULT_DRAIN_TIMEOUT
How long to wait for in-flight connections once shutdown is signalled.
DEFAULT_HEADER_READ_TIMEOUT
How long a peer may take to send a complete set of request headers.
DEFAULT_IDLE_TIMEOUT
How long a connection may sit with no bytes moving in either direction.

Traits§

Dispatcher
Trait for types that can dispatch HTTP requests to an A2A handler.

Functions§

serve
Starts an HTTP server that dispatches requests using the given dispatcher.
serve_with_addr
Starts an HTTP server and returns the bound SocketAddr.

Type Aliases§

DispatchResponse
The HTTP response type returned by dispatchers.