Honcho by default runs ambient inference on top of the message objects you store. Those messages serve as the ground truth upon which facts about the user are derived and stored. The Dialectic Endpoint is the natural language interface through which insights are synthesized from those facts. We believe intellectual respect for LLMs is paramount in building effective AI agents/apps. It follows that the LLM should know better than any human what would aid them in their generation task. Thus, the Dialectic endpoint exists for flexible agent-to-agent communication.

Automatic Fact Derivation

On every message written to a session, an automatic callback is run that will reason about the conversation and store facts in a collection named honcho. This is a reserved collection specifically for the backend Honcho agent to interact with.

Dialectic Endpoint

You can query the automatically derived facts in the honcho collection directly, or you can offload this task to our agent and use the Dialectic endpoint. This endpoint allows you to define logic enabling your agent to talk to our agent that automatically retrieves and synthesizes facts from the collection.

This chat interface is exposed via the chat endpoint. It accepts a string or a list of strings. Below is some example code on how this works.

Prerequisites

from honcho import Honcho

honcho = Honcho()

# Create or get an existing App
app = honcho.apps.get_or_create(name="demo-app")

# create or get user
user = honcho.apps.users.get_or_create(app_id=app.id, name="demo-user")

# create a new session
session = honcho.apps.users.session.create(app_id=app.id, user_id=user.id)

# (assuming some messages have been written to Honcho for the deriver to use)

Static Dialectic Call

query = "What is the user's favorite way of completing the task?"
answer = honcho.apps.users.session.chat(app_id=app.id, user_id=user.id, session_id=session.id, queries=query)

Streaming Dialectic Call

with honcho.apps.users.sessions.with_streaming_response.stream(
        app_id=app.id,
        user_id=user.id,
        session_id=session.id,
        queries="What do we know about the user",
    ) as response:
        print(response)
        for line in response.iter_text():
            print(line)
            time.sleep(0.025)

We’ve designed the Dialectic endpoint to be infinitely flexible. We wrote an incomplete list of ideas on how to use it on our blog here.