@cuylabs/channel-teams-agent-core
v0.5.1
Published
Teams adapter for @cuylabs/agent-core built on @cuylabs/channel-teams
Maintainers
Readme
@cuylabs/channel-teams-agent-core
Teams adapter for @cuylabs/agent-core, built on top of
@cuylabs/channel-teams and @cuylabs/channel-m365-agent-core.
Use this package when a Teams bot should run an agent-core-compatible turn source and still expose Teams-specific invoke handlers, routing metadata, targeted activity helpers, and proactive conversation capture.
Install
npm install @cuylabs/channel-teams-agent-core @cuylabs/agent-core @microsoft/agents-hosting @microsoft/agents-hosting-extensions-teams expressMount A Teams Agent
import { createAgent } from "@cuylabs/agent-core";
import { mountTeamsAgent } from "@cuylabs/channel-teams-agent-core";
const agent = createAgent({
model,
});
await mountTeamsAgent(agent, {
path: "/api/messages",
handlers: {
async searchCommand(ctx) {
await ctx.sendInvoke({
composeExtension: {
type: "message",
text: `Search: ${ctx.turnContext.activity.value?.query ?? ""}`,
},
});
},
},
});Adapter Layer
import { createTeamsChannelAdapter } from "@cuylabs/channel-teams-agent-core";
const teams = createTeamsChannelAdapter({
source: agent,
prepareTurn({ teams }) {
return {
scopeName: "teams-activity",
scopeAttributes: {
teamsKind: teams.kind,
teamsSurface: teams.surface,
},
context: { teams },
};
},
});Proactive Messaging
import {
captureTeamsConversationReference,
continueM365Conversation,
} from "@cuylabs/channel-teams-agent-core/proactive";
const capture = captureTeamsConversationReference(turnContext);
await continueM365Conversation(adapter, capture.conversation, async (ctx) => {
await ctx.sendActivity("Done");
});Package Boundary
Use @cuylabs/channel-teams for Teams parsing and response helpers without an
agent runtime. Use this package when you want the Teams adapter that binds
those helpers to @cuylabs/agent-core.
