CortexDB Docs
Integrations

AG2 (AutoGen)

Wrap an AG2 conversable agent with CortexDB long-term memory.

AG2 (the community fork of AutoGen) gets persistent memory through a CortexDB-backed agent wrapper.

Install

pip install cortexdbai[ag2]

Memory-backed agent

from cortexdb import Cortex
from cortexdb.integrations.ag2 import CortexDBAgent

client = Cortex(api_url="https://api-v1.cortexdb.ai", actor="agent:assistant",
                bearer=os.environ["CORTEX_TOKEN"])

agent = CortexDBAgent(
    name="assistant",
    client=client,
    scope="org:acme/agent:assistant",
    llm_config={"model": "gpt-4o"},
)

The wrapper recalls context before each reply and captures the turn afterward — your llm_config model is independent of the model CortexDB uses internally for /v1/answer.

See also

On this page