AutoGen Adapter

Status: 🔶 Beta
Language: Python
Package: hippocortex[autogen]

Install

pip install hippocortex[autogen]

Quick Start

from autogen import AssistantAgent, UserProxyAgent
from hippocortex.adapters import autogen as hx_autogen

assistant = AssistantAgent("assistant", llm_config={...})
assistant = hx_autogen.wrap(assistant, api_key="hx_live_...")

user_proxy = UserProxyAgent("user")
user_proxy.initiate_chat(assistant, message="Deploy to staging")

What It Does

  1. Reply hook: Registers a reply function (position 0) that captures incoming messages and injects synthesized context.
  2. Generate reply wrap: Wraps generate_reply() to capture outgoing assistant messages.
  3. Context injection: On the first message in a conversation, synthesizes past context and inserts a system message.

Configuration

agent = hx_autogen.wrap(
    agent,
    api_key="hx_live_...",       # Required (or set HIPPOCORTEX_API_KEY)
    session_id="autogen-sess",   # Custom session ID
    inject_memory=True,          # Inject synthesized context (default: True)
)

Accessing the Adapter

agent = hx_autogen.wrap(agent, api_key="hx_live_...")
adapter = agent._hippocortex
print(adapter.session_id)

Beta Limitations

  • AutoGen is actively evolving (v0.2 → v0.4). This adapter targets the register_reply / generate_reply interface from v0.2.
  • Group chat scenarios may produce duplicate captures if multiple agents are wrapped.
  • Context injection modifies the messages list in-place (AutoGen's expected pattern).
  • The adapter uses synchronous capture (capture_sync) since AutoGen's reply system is synchronous.