Get startedView as Markdown

Quickstart

Install the SDK, initialize it once, and see your agent's conversations in the console.

1. Create an API key

In the console, open your workspace and go to API keys, or follow the Connect page. Keys start with gck_ and are shown once, so keep yours in your secret manager.

2. Install the SDK

pip install generalcontext

3. Set your key

.env
GENERALCONTEXT_API_KEY=gck_...

4. Initialize once, at startup

import generalcontext

generalcontext.initialize(app_name="support-agent")

# Every OpenAI, Anthropic, Gemini and Bedrock Converse client in the process
# is now recorded, streamed or not, sync or async, and so are OpenAI Realtime
# voice calls.

5. Group calls into conversations

One conversation (a chat, a ticket, a phone call) spans many model calls. Wrap the work for one conversation in a session, with the id you already use for it. If your agent works for several companies, add account too (more).

with generalcontext.session(conversation.id, channel="chat", user_id=customer.id):
    reply = handle(message)

6. Check it worked

Make one model call. On the Connect page, the Verify step turns green within seconds, and the conversation appears under Traces.

Next steps