# 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

Python:

```bash
pip install generalcontext
```

Node.js:

```bash
npm install generalcontext
```

## 3. Set your key

```bash
GENERALCONTEXT_API_KEY=gck_...
```

## 4. Initialize once, at startup

Python:

```python
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.
```

Node.js:

```ts
import { initialize } from 'generalcontext';
import OpenAI from 'openai';
import Anthropic from '@anthropic-ai/sdk';

initialize({ appName: 'support-agent', instrumentModules: { openAI: OpenAI, anthropic: Anthropic } });
```

> **Note:** Initialize in every process that makes model calls, including workers. In Node, passing the client classes in `instrumentModules` is the most reliable form, and required with bundlers.

## 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](https://generalcontextlabs.com/docs/sdk#accounts)).

Python:

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

Node.js:

```ts
import { withSession } from 'generalcontext';

await withSession({ sessionId: conversation.id, channel: 'chat', userId: customer.id }, () => 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**.

> **Note:** Using a coding agent? Choose **Copy setup prompt** on **Connect** and paste it into the agent: it adds the General Context skill to your codebase and connects your app. See [Use a coding agent](https://generalcontextlabs.com/docs/coding-agents).

## Next steps

- [SDK reference](https://generalcontextlabs.com/docs/sdk): Background workers, serverless, redaction and every option.
- [Outcomes and events](https://generalcontextlabs.com/docs/outcomes): Tell us what actually happened after the conversation.
- [Use a coding agent](https://generalcontextlabs.com/docs/coding-agents): Let your coding agent make these changes for you.
- [Security and data](https://generalcontextlabs.com/docs/security): Where conversations live, who reads them, how long they are kept.
