Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

posthog-agent-toolkit

⚠️ DEPRECATION NOTICE ⚠️

This package has been deprecated and will no longer receive updates.

We recommend using the PostHog MCP server directly with your preferred MCP client instead. See the PostHog MCP documentation for integration options.

Tools to give agents access to your PostHog data, manage feature flags, create insights, and more.

This is a Python wrapper around the PostHog MCP (Model Context Protocol) server, providing easy integration with AI frameworks like LangChain.

Installation

pip install posthog-agent-toolkit

Quick Start

The toolkit provides integrations for popular AI frameworks:

Using with LangChain

from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from posthog_agent_toolkit.integrations.langchain.toolkit import PostHogAgentToolkit

# Initialize the PostHog toolkit
toolkit = PostHogAgentToolkit(
    personal_api_key="your_posthog_personal_api_key",
    url="https://mcp.posthog.com/mcp"  # or your own, if you are self hosting the MCP server
)

# Get the tools
tools = await toolkit.get_tools()

# Initialize the LLM
llm = ChatOpenAI(model="gpt-5-mini")

# Create a prompt
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a data analyst with access to PostHog analytics"),
    ("human", "{input}"),
    MessagesPlaceholder("agent_scratchpad"),
])

# Create and run the agent
agent = create_tool_calling_agent(llm=llm, tools=tools, prompt=prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = await executor.ainvoke({
    "input": "Analyze our product usage by getting the top 5 most interesting insights and summarising the data from them."
})

→ See full LangChain example

Available Tools

For a list of all available tools, please see the docs.

Metadata

Release files for posthog-agent-toolkit 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for posthog-agent-toolkit 0.1.3
File Size Uploaded
posthog_agent_toolkit-0.1.3.tar.gz 68.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for posthog-agent-toolkit 0.1.3
File Interpreter ABI Platform
posthog_agent_toolkit-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 72.5 kB

Release files / posthog_agent_toolkit-0.1.3.tar.gz

Download URL posthog_agent_toolkit-0.1.3.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cd308e480ea1d2def474ba613f91ea6edc7359741bc7d1f07a5207af529a0125
BLAKE2b-256 checksum
How to use checksums
2204cf99abea74d60bf09dbd89131bc5451bfa17e31af0893bffd3e55585724e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / posthog_agent_toolkit-0.1.3-py3-none-any.whl

Download URL posthog_agent_toolkit-0.1.3-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbf74bab9a26d3d8159356e51c2066b99f23a81932fd9f2b4db8c51cf1bfa822
BLAKE2b-256 checksum
How to use checksums
0c6d62b435093f475032a5f3aff71118a788788e5cc82b79f4bd6d1088318d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page