Class WebServiceExecutor
- All Implemented Interfaces:
TypedActionExecutor
Idempotency (issue #91 phase 2)
Actions whose method (or declaring class) carries
Idempotent are routed through IdempotencyResolver
before the HTTP request is sent: cache hits short-circuit the call,
and on a miss the framework injects an Idempotency-Key
header on the request — the same header Stripe, SendGrid, Twilio,
GitHub Issues, etc. honour for upstream-side dedup. Tools without
@Idempotent bypass the resolver entirely (zero overhead).
The header is only injected on POST, PUT,
PATCH, and DELETE — the methods where duplicate
calls have observable side-effects. GET, HEAD, and
OPTIONS are safe by definition; injecting the header would
be cosmetic noise. The same client-side cache still applies to
those methods (a cached response can short-circuit them too).
For KeyStrategy.EXPLICIT, the Role can implement
IdempotencyKeySupplier to supply its own key — same
mechanism as @Tool-annotated POJOs in
ToolMethodDispatcher. EXPLICIT
suppliers must be deterministic: the framework calls the supplier
twice per call (once for the header, once for the cache lookup).
-
Constructor Summary
ConstructorsConstructorDescriptionWebServiceExecutor(IdempotencyStore idempotencyStore) Constructor with explicitIdempotencyStore. -
Method Summary
-
Constructor Details
-
WebServiceExecutor
public WebServiceExecutor() -
WebServiceExecutor
Constructor with explicitIdempotencyStore. Use to wire a Redis / Postgres adapter (when those land) or to share one store instance across multiple executors / agents in the same process.- Parameters:
idempotencyStore- store consulted forIdempotentactions; passInMemoryIdempotencyStorefor the default per-process behaviour- Since:
- 0.8.6 (issue #91 phase 2)
-
-
Method Details
-
idempotencyStore
- Returns:
- the
IdempotencyStoreconsulted forIdempotentactions. Useful for tests that need to inspect or pre-populate the cache. - Since:
- 0.8.6 (issue #91 phase 2)
-
execute
public Object execute(ActionMetadata action, Role role, Map<String, Object> parameters, Map<String, Object> context) Description copied from interface:TypedActionExecutorExecutes an action with the given parameters and context.- Specified by:
executein interfaceTypedActionExecutor- Parameters:
action- The action metadata containing annotation detailsrole- The role instance that contains the methodparameters- The parameters for the action (from message or executeAction call)context- Additional context (e.g., LLM client reference, agent reference)- Returns:
- The execution result
-