Skip to content

HTTP client

module: agentcore_rl_toolkit.runtime.client

Invoke HTTP agents using a shared asynchronous AWS client.

Constructor

AgentCoreHttpClient(
runtime_arn: str,
*,
max_pool_connections: int = 100,
read_timeout: float = 900,
request_rate_limiter: RateLimiter | None = None,
aws_client: Callable[[], Awaitable[Any]] | None = None,
)

Close the connection pool after all callers have finished using it.

get_invocation(*, session_id: str, invocation_id: str) -> InvocationHandle

Section titled “get_invocation(*, session_id: str, invocation_id: str) -> InvocationHandle”

Reconstruct a RIP handle without submitting work or making a network call.

async invoke(payload: dict, *, session_id: str, invocation_id: str | None = None, background: bool = False) -> Any

Section titled “async invoke(payload: dict, *, session_id: str, invocation_id: str | None = None, background: bool = False) -> Any”

Retain invocation_id to retry or reattach after a lost response.

async stop_session(session_id: str) -> None

Section titled “async stop_session(session_id: str) -> None”

Stop the specified Runtime session.

  • runtime_arn

A handle for one invocation.

Constructor

InvocationHandle(
client: AgentCoreHttpClient,
session_id: str,
invocation_id: str,
snapshot: InvocationState | None = None,
)

async result(timeout: float | None = None) -> Any

Section titled “async result(timeout: float | None = None) -> Any”

Wait for and return the original JSON result, or raise InvocationError.

Return the invocation state, reusing an already completed result.

  • client

  • invocation_id

  • session_id

A remote invocation failed, was interrupted, or could not be found.

Constructor

InvocationError(
session_id: str,
snapshot: InvocationState,
)
  • invocation_id

  • session_id

  • snapshot