Skip to main content
The Honcho SDKs provide ergonomic interfaces for building agentic AI applications with Honcho in Python and TypeScript/JavaScript.

Installation

Quickstart

Without configuration, the SDK defaults to the demo server. For production use:
  1. Get your API key at app.honcho.dev/api-keys
  2. Set environment="production" and provide your api_key

Core Concepts

Peers and Representations

Representations are how Honcho models what peers know. Each peer has a global representation (everything they know across all sessions) and local representations (what other specific peers know about them, scoped by session or globally).

Core Classes

Honcho Client

The main entry point for workspace operations:
Environment Variables:
  • HONCHO_API_KEY - API key for authentication
  • HONCHO_BASE_URL - Base URL for the Honcho API
  • HONCHO_WORKSPACE_ID - Default workspace ID
Key Methods:
peer() and session() always make a get-or-create API call, returning objects with cached metadata, configuration, and timestamps.

Peer

Represents an entity that can participate in conversations:

Peer Context

The context() method on peers retrieves both the working representation and peer card in a single API call:

Peer Card

The peer card contains stable biographical facts about a peer (name, preferences, background). Use get_card() / getCard() to retrieve it and set_card() / setCard() to overwrite it:
Peer cards are automatically maintained by the dreaming agent during message processing. Use set_card() / setCard() when you need to manually override or seed the card — the peer will be created automatically if it doesn’t already exist.

Conclusions

Peers can access their conclusions (facts derived from messages) through the conclusions property and conclusions_of() method:

Creating Conclusions Manually

You can also create conclusions directly, which is useful for importing data or adding explicit facts:
Manually created conclusions are marked as “explicit” and are treated the same as system-derived conclusions. Each conclusion must be tied to a session and the content length is validated against the embedding token limit.

Session

Manages multi-party conversations:
Session-Level Theory of Mind Configuration:
Theory of Mind controls whether peers can form models of what other peers think. Use observe_others=False to prevent a peer from modeling others within a session, and observe_me=False to prevent others from modeling this peer within a session.

SessionContext

Provides formatted conversation context for LLM integration:
The SessionContext object has the following structure:
Session Context Parameters:

Advanced Usage

Multi-Party Conversations

LLM Integration

Custom Message Timestamps

When creating messages, you can optionally specify a custom created_at timestamp instead of using the server’s current time:
This is useful for:
  • Importing historical conversation data
  • Backfilling messages from other systems
  • Maintaining accurate timeline ordering when processing batch data
If created_at is not provided, messages will use the server’s current timestamp.

Metadata and Filtering

See Using Filters for more examples on how to use filters.

Pagination

All list methods support page, size, and reverse parameters:

Best Practices

Resource Management

Performance Optimization