on_swml_request
on_swml_request
on_swml_request
Customization point called during SWML rendering, before the document is returned to the caller. Override this method in a subclass to inspect request data and return modifications to apply to the SWML document.
The default implementation checks for a
set_dynamic_config_callback()
and, if one is registered, returns an internal marker that triggers ephemeral
agent cloning. For most per-request customization,
set_dynamic_config_callback()
is the simpler approach.
This method is called during SWML rendering by the internal request handler. It
is not an override of SWMLService.on_request() — it is a separate hook that
adds support for dynamic configuration and ephemeral agent copies.
Parsed POST body from the incoming request, if available.
The path segment that triggered this request.
The FastAPI Request object, providing access to query parameters, headers,
and other HTTP metadata.
Optional[dict] — A dictionary of modifications to apply to the SWML document,
or None for no modifications. The keys and structure depend on the rendering
pipeline.
For most per-request customization scenarios, prefer
set_dynamic_config_callback()
which provides a higher-level interface with access to query params, body, headers,
and the agent instance.