Learn R Programming

aisdk (version 1.1.0)

ChannelRuntime: Channel Runtime

Description

Coordinates channel adapters, durable session state, and ChatSession execution for external messaging integrations.

Arguments

Public fields

session_store

Durable store for channel sessions.

Methods


Method new()

Initialize a channel runtime.

Usage

ChannelRuntime$new(
  session_store,
  model = NULL,
  agent = NULL,
  tools = NULL,
  hooks = NULL,
  registry = NULL,
  max_steps = 10,
  session_policy = channel_default_session_policy()
)

Arguments

session_store

File-backed session store.

model

Optional default model id.

agent

Optional default agent.

tools

Optional default tools.

hooks

Optional session hooks.

registry

Optional provider registry.

max_steps

Maximum tool execution steps.

session_policy

Session routing policy list.


Method register_adapter()

Register a channel adapter.

Usage

ChannelRuntime$register_adapter(adapter)

Arguments

adapter

Channel adapter instance.

Returns

Invisible self.


Method get_adapter()

Get a channel adapter.

Usage

ChannelRuntime$get_adapter(channel_id)

Arguments

channel_id

Adapter identifier.

Returns

Adapter instance.


Method handle_request()

Handle a raw channel request.

Usage

ChannelRuntime$handle_request(channel_id, headers = NULL, body = NULL, ...)

Arguments

channel_id

Adapter identifier.

headers

Request headers.

body

Raw or parsed body.

...

Optional adapter-specific values.

Returns

A normalized runtime response.


Method process_message()

Process one normalized inbound message.

Usage

ChannelRuntime$process_message(channel_id, message)

Arguments

channel_id

Adapter identifier.

message

Normalized inbound message.

Returns

Processing result list.


Method create_child_session()

Create a child session linked to a parent session.

Usage

ChannelRuntime$create_child_session(
  parent_session_key,
  child_session_key = NULL,
  inherit_history = TRUE,
  metadata = NULL
)

Arguments

parent_session_key

Parent session key.

child_session_key

Optional child key. Generated if omitted.

inherit_history

Whether to copy parent state into the child.

metadata

Optional metadata to merge into the child session.

Returns

The child session key.


Method clone()

The objects of this class are cloneable with this method.

Usage

ChannelRuntime$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.