Agent Diff provides a high-fidelity replica of the Slack Web API. Your agent can post messages, manage channels, add reactions, and more - all in an isolated environment.
from agent_diff import AgentDiffclient = AgentDiff()# Create Slack environmentenv = client.init_env( templateService="slack", templateName="slack_default", impersonateUserId="U01AGENBOT9" # User your agent acts as)# API base URLprint(env.environmentUrl)# Output: http://localhost:8000/api/env/{id}/services/slack
import requests# List channelsresponse = requests.get(f"{env.environmentUrl}/conversations.list")channels = response.json()["channels"]# Post messageresponse = requests.post(f"{env.environmentUrl}/chat.postMessage", json={ "channel": "C01GENERAL99", "text": "Hello from my agent!"})
In Agent Diff, authentication is mocked. The impersonateUserId you specify when creating the environment determines which user the agent acts as.
env = client.init_env( templateService="slack", templateName="slack_default", impersonateUserId="U01AGENBOT9" # Agent's identity)# All API calls are made as U01AGENBOT9