pip install honeai and configure it once at startup.
init
Configure the SDK with your API key. Call it once, early, before any other Hone call.endpoint to target a non-default base URL, such as a local stack:
Load the key from the environment rather than hard-coding it:
honeai.init(os.environ["HONE_API_KEY"]). See Authentication.Deployment stage (dev / staging / prod)
Tag every event from a process with its deployment stage so the dashboard can separate real production traffic from dev and staging. The Stage filter on the reliability scorecard, cost views, and triage all read it, and the scorecard defaults to production so dev noise never skews your reliability numbers. Set it once atinit, or per-deploy from the HONE_ENV environment variable:
The value is written to
metadata["environment"] on every event and canonicalized case-insensitively at write time: prod / PROD / prd → production, stg → staging, local / development → dev. Any other value is kept as-is (lowercased), so a custom stage like qa is never folded into the wrong bucket. The explicit init argument wins over HONE_ENV.
Leave both unset and no stage tag is written — the scorecard then shows a “Tag traffic” banner. You can also set the stage on an individual turn with
interaction.set_property("environment", "staging"), which overrides the process-wide value.begin and end
begin() opens an interaction for a single agent turn and returns an object you close with end(). This is the most explicit way to record a turn, and it captures latency automatically from the time between the two calls.
begin parameters
end parameters
Mark a failed turn so it surfaces in error analytics:
track
track() records a completed turn in a single call. Reach for it when you already have both the input and the output in hand and do not need to hold an interaction open.
Multi-tenant (customer_id)
When one agent serves several of your own customers, passcustomer_id so each session and event is scoped to the downstream tenant it belongs to. The end-user’s identity becomes the pair (customer_id, user_id), and the dashboard can filter and roll up per customer.
customer_id is a first-class field — pass it as the argument, not via set_property, so per-customer scoping and rollups work. It is stamped on the session and every event of the turn. Omit it entirely for single-tenant agents.Conversation grouping
A conversation is a series of turns between one user and your agent. Pass the sameconversation_id across track() calls to thread them together, so the dashboard shows them as one exchange under User Stories rather than as isolated turns.
identify
identify() attaches traits to a user id. Traits enrich the user profile in the dashboard and become dimensions you can filter and segment on. Keep the id pseudonymous and avoid putting raw personal data in the traits.
set_property and set_properties
Within an open interaction, attach custom properties such as the model used, token counts, or cost. These ride along on the event and power metadata-driven charts and filters.set_property for a single key and set_properties to attach several at once. Define the corresponding keys under Settings → Metadata Keys so they become selectable dimensions in the dashboard.
Full example
To capture MCP tool, resource, and prompt calls automatically, see MCP.