To make things easy, there’s an instance of Honcho up and running on a demo server at https://demo.honcho.dev. The python package defaults to this instance, so let’s dive into how to get up and running!

Install the Honcho client SDK with the following commands:

pip install honcho-ai

First, import the Client from the package:

from honcho import Honcho
honcho = Honcho(
    # This is the default and can be omitted
    api_key=os.environ.get("HONCHO_AUTH_TOKEN"),
    # defaults to "local".
    environment="demo",
)

Next, we want to register an application with the Honcho client:

app = client.apps.get_or_create(
    name="string",
)

This will create an application with the above name if it does not already exist or retrieve it if it does. After we have our application initialized, we can make a user with the following:

user = honcho.apps.users.create(app_id=app.id, name="User")

Now let’s create a session for that application. Honcho is a user context management system, so you can create sessions for users. Thus, a user_id is required.

session = client.apps.users.sessions.create(user.id, app.id, location_id=default)

Let’s add a user message and an AI message to that session:

client.apps.users.sessions.messages.create(session.id, app.id, user.id, content="Test", is_user=True)

You can also easily query Honcho to get the session objects for that user with the following:

async for session in client.apps.users.list(app.id, user.id):
  doSomethingWith(session)

This is a super simple overview of how to get up and running with the Honcho SDK. We covered the basic methods for reading and writing from the hosted storage service. Next, we’ll cover alternative forms of hosting Honcho.

For a more detailed look at the SDK check out the SDK reference here.