InvocationHandler Class

Definition

Base class for handling invocation requests. Only HandleAsync(HttpRequest, HttpResponse, InvocationContext, CancellationToken) is required. Override the optional methods to opt in to GET, cancel, and OpenAPI endpoints (they return 404 by default).

public abstract class InvocationHandler
type InvocationHandler = class
Public MustInherit Class InvocationHandler
Inheritance
InvocationHandler
Derived

Remarks

To opt in to the invocations_ws (WebSocket) transport, derive from InvocationWebSocketHandler instead.

Constructors

Name Description
InvocationHandler()

Methods

Name Description
CancelAsync(String, HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles POST /invocations/{invocationId}/cancel. Returns 404 by default. Override to support cancellation.

GetAsync(String, HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles GET /invocations/{invocationId}. Returns 404 by default. Override to support polling for async/LRO invocations.

GetOpenApiAsync(HttpRequest, HttpResponse, CancellationToken)

Handles GET /invocations/docs/openapi.json. Returns 404 by default. Override to return an OpenAPI spec for the agent's contract.

HandleAsync(HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles a POST /invocations request. Required.

Applies to