Creating AI Adapters
Creating AI Adapters
Section titled “Creating AI Adapters”This file is retained only as a legacy entry point. The current adapter authoring guide is:
- framework/docs/creating-adapters.md
Do not use the old object-interface examples that returned an AIAdapter literal with
sendMessage() and getCapabilities() methods. Current adapters use the three-layer class
model:
AIAdapter -> AIAgent -> AIAgentConnectorAn AIAdapter subclass declares constructor-time factories:
agentFactorycreates theAIAgentsubclass.configFactoryresolves runtime connector configuration.connectorFactorycreates theAIAgentConnectorsubclass.
Runtime calls are bus based:
- Use
AdapterSubjects.startAgentto create/start an agent. - Use
AgentSubjects.sendMessageto continue an existing agent. - Use
AdapterSubjects.inferfor one-shot inference without registering a long-lived agent.
Capabilities are construction-time declarations on the adapter class. Declare only capability
tokens implemented by the adapter, such as tools, vision, structuredOutput,
systemPrompt:override, systemPrompt:append, session:resume, session:fork,
streaming, chatInTurnMessages, and modelSwitchInSession.
chatInTurnMessages is the current compatibility spelling emitted by existing adapters. The
registry-shaped alias is chat:inTurnMessages; only use that spelling after the adapter itself
declares it, because capability checks compare exact strings.