Skip to main content

Hone Python SDK — capture AI-agent conversations and MCP tool calls to Hone's observability platform.

Project description

Hone Python SDK

hone is the Python SDK for Hone, an AI-agent observability platform. Use it to capture agent conversations and MCP tool calls and send them to Hone's ingestion edge.

Install

uv add hone
# with MCP tool-call capture:
uv add "hone[mcp]"

Configuration

The SDK reads its configuration from arguments or the environment:

Setting Argument Environment Default
API key honeai.init(api_key) HONE_API_KEY — (required)
Endpoint honeai.init(endpoint=) HONE_ENDPOINT https://api.hone.dev

API keys look like sk_<hex>. For local development, point the endpoint at http://localhost:8080.

Quick start

import honeai

honeai.init("sk_...")  # or rely on HONE_API_KEY

# A single turn you want to time and enrich:
turn = honeai.begin(user_id="user-123", agent_name="support-bot", input="How do I reset my password?")
turn.set_property("channel", "web")
turn.set_properties({"tier": "pro"})
turn.end("Head to Settings > Security to reset it.")

begin starts a new conversation (a fresh session_id) and records the start time. end posts a capture-session (once per new conversation) plus a capture-event with an auto-computed latency.

One-shot capture

honeai.track(
    user_id="user-123",
    input="What's my balance?",
    output="Your balance is $42.",
    agent_name="finance-bot",
)

Group several turns into one conversation by passing a shared conversation_id:

convo = "9f8b..."  # any stable id
honeai.track(user_id="u1", input="hi", output="hello", agent_name="bot", conversation_id=convo)
honeai.track(user_id="u1", input="bye", output="see you", agent_name="bot", conversation_id=convo)

User traits

Register traits that decorate the user's next session:

honeai.identify("user-123", {"plan": "enterprise", "name": "Ada"})
honeai.begin(user_id="user-123", agent_name="bot", input="hi").end("hello")
# ^ the session's user_data carries plan + name

MCP tool-call capture

Wrap a FastMCP server so every tool call is captured as a TOOL event:

from mcp.server.fastmcp import FastMCP
import honeai.mcp

server = FastMCP("my-server")

@server.tool()
def add(a: int, b: int) -> int:
    return a + b

honeai.init("sk_...")
honeai.mcp.track(server)  # instruments the server in place

Pass disable_input=True and/or disable_output=True to omit tool arguments or return values from the captured events. mcp is an optional dependency; if it is not installed, honeai.mcp.track logs a warning and returns the server unchanged.

Error handling

Network and HTTP failures never raise into your hot path by default — they are logged (via the hone logger) and dropped. For tests, construct a client with raise_on_error=True:

from honeai.client import Client
client = Client("sk_test", raise_on_error=True)

Development

uv sync
uv run pytest
uv run ruff check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asymmetric_hone-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asymmetric_hone-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file asymmetric_hone-0.1.0.tar.gz.

File metadata

  • Download URL: asymmetric_hone-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for asymmetric_hone-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b82b2267ff2154f1a66f1fdd34e8c999fe4d7ff6e90c1ae82a9940375959ead4
MD5 5b5a578fe20db9419762fb9d4566ec3f
BLAKE2b-256 190af6f7c1e8aa3094a493c53ba902a2a09a5226563bb69821e935ecd4a5d09b

See more details on using hashes here.

File details

Details for the file asymmetric_hone-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for asymmetric_hone-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dbd895b701bb1183cee260128a240cd3e5840a2741de8aa8c20856ce5a28c69
MD5 87a3d3f65fbcc0b97f95278a1d760ab3
BLAKE2b-256 efc93d9471c71310a8b0f5d1032367482e70f279ff58bab48a34a091c25f2daf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page