Skip to main content

BasePlatformAdapter

Defined in the base module.
AI Agent Inheritable base class for gateway platform/channel adapters. Subclasses implement a minimal abstract contract (four methods) and inherit capability-driven default behaviour (chunking, retry/backoff, typing heartbeat, edit/delete fallbacks, formatting). Override any default only when the platform can do better. Declare platform features by setting the class attribute :attr:capabilities to a :class:PlatformCapabilities instance. The default delivery path reads capabilities via getattr so it degrades gracefully when a flag is absent.

Properties

PlatformCapabilities
No description available.
int
No description available.
float
No description available.
bool
No description available.

Methods

connect()

Establish the platform connection.

disconnect()

Tear down the platform connection and release resources.

send()

Send a single message to chat_id (one API call, no chunking).

get_chat_info()

Return metadata about a chat/channel (at least an id key).

start()

Establish the connection and run the inbound loop until stopped.

stop()

Signal the inbound loop to stop and tear down the connection.

max_message_length()

Platform max message length (0 = unlimited).

supports_edit()

Whether the platform supports in-place message edits.

supports_typing()

Whether the platform supports typing indicators.

format_message()

Render text for the platform’s declared markdown_dialect.

chunk()

Split text to respect the platform max length.

send_typing()

Send a typing indicator. Default no-op unless capability set.

edit_message()

Edit an existing message.

delete_message()

Delete a message. Default: not supported → returns False.

classify_error()

Map a native send exception into a classified :class:SendResult.

deliver()

Robustly deliver content, inheriting all shared machinery.

Source

View on GitHub

praisonaiagents/bots/base.py at line 341