add_per_call_config
add_per_call_config
Register a per-request configuration callback, keeping any already registered.
Same signature and contract as
set_dynamic_config_callback(), except that
callbacks accumulate instead of overwriting. They run in registration order
against the same ephemeral agent, so a later callback sees what an earlier one
configured and can build on or override it.
Prefer this form when composing. A base class and a subclass, or an agent and a
mixin, can each register what they own without knowing about the other. With
set_dynamic_config_callback() the second registration silently drops the
first.
Parameters
callback
A function with the signature (query_params, body_params, headers, agent).
agent is the ephemeral per-request copy. Configure that object, never
self, or the configuration leaks across callers.
Returns
AgentBase — Returns self for method chaining.