Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Let a room's owner or a workspace admin name the triage agent from chat
agent-runner3537768c8f024a1
diff --git a/core/switch_core/bridges/agent/commands.py b/core/switch_core/bridges/agent/commands.pyindex 0f1b266d2..45b9008dc 100644--- a/core/switch_core/bridges/agent/commands.py+++ b/core/switch_core/bridges/agent/commands.py@@ -526,10 +526,15 @@ async def _manages_room(room_id: str,sender: str,command: str,+ *,+ resolver: AddressingResolver | None = None,) -> bool:"""Whether the Switch user behind `sender` owns the room or administers- the tenant. `command` names the chat command in the admin audit record."""- principal = await client._addressing.resolve_sender(session, sender)+ the tenant. `command` names the chat command in the admin audit record.+ `resolver` resolves the sender; an agent's own recipient has one, and the+ Switch app's command consumer passes `_command_resolver(host)`."""+ resolve = resolver if resolver is not None else client._addressing+ principal = await resolve.resolve_sender(session, sender)if principal is None or principal.kind != "user":return Falseroom = await session.get(Room, room_id)@@ -1032,8 +1037,14 @@ async def _auto_route_fallback(if len(args) > 1:await _reply(client, room, event, _AUTO_ROUTE_USAGE)return+ host = cast("CommandConsumer", client)if not await _manages_room(- client, session, room_id, event.user_id, "auto-route fallback"+ client,+ session,+ room_id,+ event.user_id,+ "auto-route fallback",+ resolver=_command_resolver(host),):await _reply(client, room, event, _AUTO_ROUTE_FALLBACK_REFUSED)return@@ -1475,6 +1486,19 @@ async def _cmd_remove_agent(await _reply(client, room, event, f"Removed **{_label(target)}** from this room.")+def _command_resolver(host: CommandConsumer) -> AddressingResolver:+ """Who sent a command, for the Switch app's command consumer, which has+ no addressing resolver of its own (an agent's recipient does)."""+ return AddressingResolver(+ room_store=host._room_store,+ room_role_store=host._room_role_store,+ client_store=host.client_store,+ agent_store=host._agent_store,+ external_user_store=host._external_user_store,+ live_connection_ids=host._connections.live_connection_ids,+ )++async def _may_remove_agent(host: CommandConsumer,session: AsyncSession,@@ -1487,14 +1511,7 @@ async def _may_remove_agent(Anyone the agent would take instructions from may; so may a workspaceadmin, and an agent that manages agents for the target's owner."""- resolver = AddressingResolver(- room_store=host._room_store,- room_role_store=host._room_role_store,- client_store=host.client_store,- agent_store=host._agent_store,- external_user_store=host._external_user_store,- live_connection_ids=host._connections.live_connection_ids,- )+ resolver = _command_resolver(host)decision = await resolver.permitted(session, agent=target, room_id=room_id, sender=event.user_id)diff --git a/core/tests/switch_core/bridges/agent/test_commands_auto_route.py b/core/tests/switch_core/bridges/agent/test_commands_auto_route.pyindex 645f1dbf7..bee3544da 100644--- a/core/tests/switch_core/bridges/agent/test_commands_auto_route.py+++ b/core/tests/switch_core/bridges/agent/test_commands_auto_route.py@@ -9,6 +9,7 @@ from types import SimpleNamespaceimport pytestfrom sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker+from switch_core.bridges.agent import commandsfrom switch_core.bridges.agent.commands import COMMANDS_BY_NAME, _cmd_auto_routefrom switch_core.bridges.collaboration.own_app_setup import slack_manifestfrom switch_core.db.models import (@@ -98,7 +99,10 @@ def _host(reply_command=_reply_command,_room_store=RoomStore(),_agent_store=AgentStore(),- _addressing=SimpleNamespace(resolve_sender=_resolve_sender),+ # Not `_addressing`: the Switch app's command consumer has no+ # resolver of its own, so the command builds one from its stores+ # (`_command_resolver`, stubbed below to resolve to `sender`).+ _fake_resolve_sender=_resolve_sender,_decision_availability=DecisionAvailability(enabled=flag,server=ServerDefault(@@ -112,6 +116,16 @@ def _host(return host, posted[email protected](autouse=True)+def _resolve_through_the_host(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(+ commands,+ "_command_resolver",+ lambda host: SimpleNamespace(resolve_sender=host._fake_resolve_sender),+ raising=False,+ )++async def _run(host: SimpleNamespace, args: str) -> None:event = SimpleNamespace(command="auto-route", args=args, thread_id=None, user_id="@sender:test"