Skip to main content

io.enterpriseai.resources.ContextClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/ContextClient.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class ContextClient​

Context Manager budget and compression planning.

Constructor ContextClient​

ContextClient(Transport transport)

Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.

NameTypeDefaultRequiredDescription
transportTransportyesTransport shared by the sub-clients of one client.

ContextClient.issue​

JsonNode issue(Object body)

Issue a signed execution context. Builds and signs an ExecutionContext for the caller and returns token, context_id, kid, alg, issued_at and expires_at (201). - With run_id: the caller must have created the run, be its root principal or the user it acts for, or hold agent, tenant_admin or security_officer (403 forbidden); the delegation of the run is checked again and the agent manifest is included. - With delegation_id: the delegation must be valid and the caller one of its parties, or agent or tenant_admin. Errors: 400 context_wrong_audience for an audience the platform does not accept, 400 context_ttl_exceeded, 403 delegation_expired, 503 context_authority_unavailable. Audited as context.issue.

Route: /v1/context/issue (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesAudience, lifetime and the run or delegation the context is for.

Returns: JsonNode. Decoded JSON answer of the operation "Issue a signed execution context".

Raises: the typed errors of the transport (Errors).

ContextClient.issue​

JsonNode issue(Object body, RequestOptions options)

Issue a signed execution context. Builds and signs an ExecutionContext for the caller and returns token, context_id, kid, alg, issued_at and expires_at (201). - With run_id: the caller must have created the run, be its root principal or the user it acts for, or hold agent, tenant_admin or security_officer (403 forbidden); the delegation of the run is checked again and the agent manifest is included. - With delegation_id: the delegation must be valid and the caller one of its parties, or agent or tenant_admin. Errors: 400 context_wrong_audience for an audience the platform does not accept, 400 context_ttl_exceeded, 403 delegation_expired, 503 context_authority_unavailable. Audited as context.issue.

Route: /v1/context/issue (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesAudience, lifetime and the run or delegation the context is for.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Issue a signed execution context".

Raises: the typed errors of the transport (Errors).

ContextClient.jwks​

JsonNode jwks()

Get the public verification keys. Public verification keys as a JWKS (active, and retired ones still inside their verification window), each with kid, alg (ES256 or EdDSA) and use: sig. Any authenticated principal may read it. 503 context_authority_unavailable when the key registry cannot be read.

Route: /v1/context/jwks (GET).

This element takes no parameter.

Returns: JsonNode. Decoded JSON answer of the operation "Get the public verification keys".

Raises: the typed errors of the transport (Errors).

ContextClient.keys​

JsonNode keys()

List the signing keys. Registry of the context signing keys: kid, algorithm, status, dates of use, retirement and revocation. Needs security_officer or auditor. 503 context_authority_unavailable when the registry cannot be read.

Route: /v1/context/keys (GET).

This element takes no parameter.

Returns: JsonNode. Decoded JSON answer of the operation "List the signing keys".

Raises: the typed errors of the transport (Errors).

ContextClient.plan​

JsonNode plan(Object body)

Plan the context window. Context Manager dry run: computes the token budget of a model window (output, reasoning and safety reserves) and which segments are kept, compressed or dropped by priority. With model, the window and output reserve come from the registry. A window that is not a positive integer answers 422 parameter_invalid; segments that cannot fit answer 422 context_overflow. Requires a reader role.

Route: /v1/context/plan (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesmodel (or model_id), or window (tokens); output (reserved output tokens, default the model maximum capped at 4096), reasoning (reserved reasoning tokens), safety (margin) and segments (each with type, optional segment_id, priority, classification and its content).

Returns: JsonNode. Decoded JSON answer of the operation "Plan the context window".

Raises: the typed errors of the transport (Errors).

ContextClient.plan​

JsonNode plan(Object body, RequestOptions options)

Plan the context window. Context Manager dry run: computes the token budget of a model window (output, reasoning and safety reserves) and which segments are kept, compressed or dropped by priority. With model, the window and output reserve come from the registry. A window that is not a positive integer answers 422 parameter_invalid; segments that cannot fit answer 422 context_overflow. Requires a reader role.

Route: /v1/context/plan (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesmodel (or model_id), or window (tokens); output (reserved output tokens, default the model maximum capped at 4096), reasoning (reserved reasoning tokens), safety (margin) and segments (each with type, optional segment_id, priority, classification and its content).
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Plan the context window".

Raises: the typed errors of the transport (Errors).

ContextClient.revoke​

JsonNode revoke(String contextId)

Revoke an execution context. Revokes an issued context before it expires; verifying it then answers context_revoked. Allowed for the principal that issued it, or tenant_admin or security_officer (403 forbidden). Revoking twice keeps the first date. 404 context_not_found. Audited as context.revoke.

Route: /v1/context/{context_id}/revoke (POST).

NameTypeDefaultRequiredDescription
contextIdStringyesIdentifier (UUID) of the context, the jti claim of its token.

Returns: JsonNode. Decoded JSON answer of the operation "Revoke an execution context".

Raises: the typed errors of the transport (Errors).

ContextClient.revoke​

JsonNode revoke(String contextId, RequestOptions options)

Revoke an execution context. Revokes an issued context before it expires; verifying it then answers context_revoked. Allowed for the principal that issued it, or tenant_admin or security_officer (403 forbidden). Revoking twice keeps the first date. 404 context_not_found. Audited as context.revoke.

Route: /v1/context/{context_id}/revoke (POST).

NameTypeDefaultRequiredDescription
contextIdStringyesIdentifier (UUID) of the context, the jti claim of its token.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Revoke an execution context".

Raises: the typed errors of the transport (Errors).

ContextClient.revokeKey​

JsonNode revokeKey(String kid, Object body)

Revoke a signing key. Revokes a context signing key at once: the contexts it signed no longer verify. Needs platform_admin. 404 signing_key_not_found. Audited as context.key.revoke at platform level.

Route: /v1/context/keys/{kid}/revoke (POST).

NameTypeDefaultRequiredDescription
kidStringyesKey id, the RFC 7638 thumbprint of the public key.
bodyObjectyesReason of the revocation.

Returns: JsonNode. Decoded JSON answer of the operation "Revoke a signing key".

Raises: the typed errors of the transport (Errors).

ContextClient.revokeKey​

JsonNode revokeKey(String kid, Object body, RequestOptions options)

Revoke a signing key. Revokes a context signing key at once: the contexts it signed no longer verify. Needs platform_admin. 404 signing_key_not_found. Audited as context.key.revoke at platform level.

Route: /v1/context/keys/{kid}/revoke (POST).

NameTypeDefaultRequiredDescription
kidStringyesKey id, the RFC 7638 thumbprint of the public key.
bodyObjectyesReason of the revocation.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Revoke a signing key".

Raises: the typed errors of the transport (Errors).

ContextClient.verify​

JsonNode verify(Object body)

Verify a signed execution context. Checks a token and returns valid, context_id, kid, alg, the claims and the context document. Checks, in order: structure and canonical form (context_malformed), algorithm and signature (context_invalid_signature), known non revoked key (context_unknown_key), issuer (context_wrong_issuer), audience (context_wrong_audience), lifetime (context_expired), tenant of the caller (403 context_tenant_mismatch), issuance record (context_revoked), digest of the document and delegation chain (a revoked delegation gives context_revoked). Refusals answer 401 unless stated and are audited; a success binds the verified identity to the audit events of the request.

Route: /v1/context/verify (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesToken to verify and expected audience.

Returns: JsonNode. Decoded JSON answer of the operation "Verify a signed execution context".

Raises: the typed errors of the transport (Errors).

ContextClient.verify​

JsonNode verify(Object body, RequestOptions options)

Verify a signed execution context. Checks a token and returns valid, context_id, kid, alg, the claims and the context document. Checks, in order: structure and canonical form (context_malformed), algorithm and signature (context_invalid_signature), known non revoked key (context_unknown_key), issuer (context_wrong_issuer), audience (context_wrong_audience), lifetime (context_expired), tenant of the caller (403 context_tenant_mismatch), issuance record (context_revoked), digest of the document and delegation chain (a revoked delegation gives context_revoked). Refusals answer 401 unless stated and are audited; a success binds the verified identity to the audit events of the request.

Route: /v1/context/verify (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesToken to verify and expected audience.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Verify a signed execution context".

Raises: the typed errors of the transport (Errors).