Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/yaalalabs/agent-kernel/ak-dev-new-messaging-integrationnpx skills add yaalalabs/agent-kernel --skill ak-dev-new-messaging-integrationgit clone --depth 1 https://github.com/yaalalabs/agent-kernelWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/yaalalabs/agent-kernel/ak-dev-new-messaging-integration)<a href="https://agentmods.dev/skills/yaalalabs/agent-kernel/ak-dev-new-messaging-integration"><img src="https://agentmods.dev/badge/skills/yaalalabs/agent-kernel/ak-dev-new-messaging-integration.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00074 | $0.02600 |
| Opus 5 | $0.00037 | $0.01300 |
| Sonnet 5 | $0.00015 | $0.00520 |
| Haiku 4.5 | $0.00007 | $0.00260 |
Grade A, and why
ak-dev-new-messaging-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 312 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Adding a New Messaging Integration
This guide walks through adding a new messaging platform integration to Agent Kernel. Use the Slack integration (ak-py/src/agentkernel/integration/slack/) as the canonical reference.
Architecture Overview
Messaging integrations follow a consistent pattern:
- A request handler class that extends
RESTRequestHandler - The handler exposes FastAPI routes for webhooks
- Incoming messages are parsed into
AgentRequestmodels (platform attachments downloaded and base64-encoded by the handler) - The ChatService execution core runs the agent: build a
BaseChatRequestand callexecute(req, requests=<prebuilt list>), which returns the typed reply. Integrations own their transport and reply formatting, so they call the core, never the HTTP-shapedprocess_*wrappers and neverAgentServicedirectly (see the chat execution layering rubric inak-dev-architecture) - The reply is formatted and sent back via the platform's API; a
ValueErrorfromexecutemaps to the platform's "no agent available" message - Configuration is added to
AKConfig(accessed via theConfig.get()alias) for platform-specific settings
Exception: Gmail does not follow the webhook pattern.
AgentGmailRequestHandler(integration/gmail/gmail_chat.py) has no base class and polls email via OAuth instead of exposing webhook routes; its config (_GmailConfigincore/config.py) hastoken_file,poll_interval, andlabel_filterrather than a webhook secret.
Step-by-Step
1. Create the Integration Directory
ak-py/src/agentkernel/integration/<platform>/
├── __init__.py
└── <platform>_chat.py
2. Implement the Request Handler
# ak-py/src/agentkernel/integration/<platform>/<platform>_chat.py
import logging
from agentkernel.api.handler import RESTRequestHandler
from agentkernel.core import ChatService, Config
from agentkernel.core.model import AgentRequestText, AgentRequestImage, AgentRequestFile, BaseChatRequest
from fastapi import APIRouter, Request
logger = logging.getLogger("ak.integration.<platform>")
class Agent<Platform>RequestHandler(RESTRequestHandler):
"""Handles incoming messages from <Platform> and routes them to Agent Kernel agents."""
def __init__(self):
config = Config.get().<platform>
self._agent_name = config.agent if config else None
self._chat_service = ChatService()
# Initialize platform-specific client/SDK here
# e.g., self._client = PlatformClient(token=config.bot_token)
def get_router(self) -> APIRouter:
router = APIRouter()
@router.get("/health")
async def health():
return {"status": "ok"}
@router.post("/<platform>/webhook")
async def webhook(request: Request):
body = await request.json()
await self._handle_message(body)
return {"status": "ok"}
return router
async def _handle_message(self, body: dict):
"""Parse platform message and route to agent."""
# 1. Extract message content from platform-specific format
user_id = body.get("user_id", "unknown")
text = body.get("text", "")
attachments = body.get("attachments", [])
# 2. Build request list
requests = []
if text:
requests.append(AgentRequestText(prompt=text))
for attachment in attachments:
# Handle images
if attachment.get("type") == "image":
image_data = await self._download_file(attachment["url"])
requests.append(AgentRequestImage(
image_data=image_data,
name=attachment.get("name", "image"),
mime_type=attachment.get("mime_type")
))
# Handle files
elif attachment.get("type") == "file":
file_data = await self._download_file(attachment["url"])
requests.append(AgentRequestFile(
file_data=file_data,
name=attachment.get("name", "file"),
mime_type=attachment.get("mime_type")
))
if not requests:
return
# 3. Run through the ChatService execution core with the prebuilt request list
# (prompt may be empty for attachment-only messages; user_id/group_id are
# best-effort platform identity)
req = BaseChatRequest(prompt=text, agent=self._agent_name, session_id=user_id, user_id=user_id)
try:
reply, _ = await self._chat_service.execute(req, requests=requests)
except ValueError as ve:
logger.warning(f"Agent execution rejected: {ve}")
await self._send_reply(user_id, "Sorry, no agent is available to handle your request.")
return
# 4. Send reply back via platform API
await self._send_reply(user_id, str(reply))
async def _download_file(self, url: str) -> str:
"""Download a file and return base64-encoded content."""
import base64
import httpx
async with httpx.AsyncClient() as client:
response = await client.get(url, headers=self._auth_headers())
return base64.b64encode(response.content).decode("utf-8")
async def _send_reply(self, channel: str, text: str):
"""Send reply back to the messaging platform."""
# Platform-specific API call to send message
# e.g., self._client.send_message(channel=channel, text=text)
pass
def _auth_headers(self) -> dict:
"""Return auth headers for platform API calls."""
return {}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 312 lines · 74 tokens per session scan A 0cb3dadbbff7
ak-dev-new-messaging-integration is a skill published in the GitHub repository yaalalabs/agent-kernel (166 stars, last pushed yesterday), licensed Apache-2.0. It adds 74 tokens to every session and 2,600 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
notion
Notion workspace integration for searching pages, managing databases, creating postmortems, and exporting RCA findings.
datadog
Datadog monitoring integration for querying logs, metrics, monitors, events, traces, hosts, and incidents during RCA investigations.
scaleway
Scaleway cloud integration for managing instances, Kapsule Kubernetes clusters, object storage, and managed databases via CLI and Terraform.
isaac-automator
Deploy and operate a cloud Isaac Workstation with Isaac Automator: provision a GPU VM running Isaac Sim, Isaac Lab, and/or Isaac Lab Arena on AWS, GCP, Azure, or Alibaba Cloud, connect to it, move data in and out, control cost with stop/start, repair, import existing deployments, and destroy. Use when the user wants a…
bitbucket
Bitbucket code repository integration for managing repos, branches, PRs, issues, and CI/CD pipelines.
github
GitHub code repository integration for investigating code changes, deployments, commits, PRs, and suggesting fixes during RCA.