pub struct LambdaA2aServerBuilder { /* private fields */ }Expand description
Builder for Lambda A2A handler.
Use .storage(my_storage) to supply a single backend implementing all storage traits.
All four storage traits must share the same backend so streaming, push delivery,
and cross-instance cancellation coordinate correctly.
For push-notification delivery, wire .storage() with a backend that implements
A2aPushDeliveryStore (all four first-party backends do). The atomic store
must also opt in via with_push_dispatch_enabled(true); the
builder rejects configurations where the flag and the delivery store disagree.
Implementations§
Source§impl LambdaA2aServerBuilder
impl LambdaA2aServerBuilder
pub fn new() -> Self
Sourcepub fn strip_path_prefix(self, prefix: impl Into<String>) -> Self
pub fn strip_path_prefix(self, prefix: impl Into<String>) -> Self
Configure an HTTP path prefix to strip before the A2A router
sees the request. Needed when Lambda sits behind an API Gateway
whose stage + resource tree is forwarded into the function
(e.g. REST API AWS_PROXY integrations surface
/stage/agent/message:send where the A2A
router expects /message:send).
The prefix must start with / and must not end with /
(unless it is exactly /, which is a no-op). Segment boundaries
are respected — a prefix of /dev will not strip /devs/....
Paths that do not start with the prefix pass through unchanged
(the router will 404 on a genuinely unknown path, which is the
correct failure mode). Applies to both
LambdaA2aHandler::run_http_only and
[LambdaA2aHandler::run_http_and_sqs]. SQS events are
unaffected.
Sourcepub fn with_durable_executor(self, queue: Arc<dyn DurableExecutorQueue>) -> Self
pub fn with_durable_executor(self, queue: Arc<dyn DurableExecutorQueue>) -> Self
Wire a durable executor queue. When set, the
return_immediately = true path in core_send_message enqueues
a turul_a2a::durable_executor::QueuedExecutorJob on this
queue instead of spawning the executor locally, and the
capability flag RuntimeConfig::supports_return_immediately is
turned back on as an implementation detail — the capability
cannot be claimed without supplying the queue.
Adopters should typically reach for the SQS-specific helper
[Self::with_sqs_return_immediately] instead; this generic
method exists so adopters can inject in-memory fakes for tests
or provide non-SQS transports (Kinesis, Step Functions task
token, self-invoke, etc.).
pub fn executor(self, exec: impl AgentExecutor + 'static) -> Self
Sourcepub fn storage<S>(self, storage: S) -> Selfwhere
S: A2aTaskStorage + A2aPushNotificationStorage + A2aEventStore + A2aAtomicStore + A2aCancellationSupervisor + Clone + 'static,
pub fn storage<S>(self, storage: S) -> Selfwhere
S: A2aTaskStorage + A2aPushNotificationStorage + A2aEventStore + A2aAtomicStore + A2aCancellationSupervisor + Clone + 'static,
Set all storage from a single backend instance.
This is the preferred method — a single struct implementing all storage traits guarantees the same-backend requirement AND ensures the cancellation supervisor reads the same backend the cancel marker is written to. A mismatch here (e.g., DynamoDB task storage + in-memory cancellation supervisor) silently breaks cross-instance cancellation.
errata: .storage() wires storage traits only. It does
not auto-register the storage as a push-delivery store, even if
the backend happens to implement A2aPushDeliveryStore. To opt in
to push delivery, call Self::push_delivery_store explicitly and
call with_push_dispatch_enabled(true) on the storage instance
before passing it here. Non-push deployments need neither.
Sourcepub fn task_storage(self, s: impl A2aTaskStorage + 'static) -> Self
pub fn task_storage(self, s: impl A2aTaskStorage + 'static) -> Self
Set task storage individually. Must be paired with event_store/atomic_store
AND cancellation_supervisor() for same-backend compliance.
Sourcepub fn push_storage(self, s: impl A2aPushNotificationStorage + 'static) -> Self
pub fn push_storage(self, s: impl A2aPushNotificationStorage + 'static) -> Self
Set push notification storage individually.
Sourcepub fn event_store(self, s: impl A2aEventStore + 'static) -> Self
pub fn event_store(self, s: impl A2aEventStore + 'static) -> Self
Set event store individually. Must match task_storage backend.
Sourcepub fn atomic_store(self, s: impl A2aAtomicStore + 'static) -> Self
pub fn atomic_store(self, s: impl A2aAtomicStore + 'static) -> Self
Set atomic store individually. Must match task_storage backend.
Sourcepub fn cancellation_supervisor(
self,
s: impl A2aCancellationSupervisor + 'static,
) -> Self
pub fn cancellation_supervisor( self, s: impl A2aCancellationSupervisor + 'static, ) -> Self
Set the cancellation supervisor individually. Must match
task_storage backend — otherwise :cancel writes the marker to
one backend and the supervisor reads from another, silently
breaking cross-instance cancellation. Prefer .storage() for
unified wiring. Consumed by core_cancel_task.
Sourcepub fn push_delivery_store(
self,
store: impl A2aPushDeliveryStore + 'static,
) -> Self
pub fn push_delivery_store( self, store: impl A2aPushDeliveryStore + 'static, ) -> Self
Set the push delivery store individually.
Prefer .storage() for unified wiring. The delivery store MUST
be on the same backend as .task_storage(...) — the builder
rejects mismatches. Passing a delivery store also requires the
atomic store to have opted in via with_push_dispatch_enabled(true)
.
Sourcepub fn runtime_config(self, cfg: RuntimeConfig) -> Self
pub fn runtime_config(self, cfg: RuntimeConfig) -> Self
Override the runtime configuration (timeouts, retry budgets,
push tuning). Defaults to RuntimeConfig::default(). The
builder validates push settings (claim expiry vs retry horizon,
) when .push_delivery_store(...) is wired.