Skip to main content

generalcontext

Record your AI agent's model calls for General Context. We read your agent's production conversations and find where it goes wrong, and each failure you confirm becomes an RL and eval task built from the conversation. Your tasks together are your benchmark.

Recording never gets in your agent's way: calls are sent in the background, a failure on our side is logged and dropped, never raised, and there are no runtime dependencies.

Install

pip install generalcontext
export GENERALCONTEXT_API_KEY=gck_...   # from your workspace's Connect page

Record

import generalcontext

generalcontext.initialize(app_name="support-agent")   # once per process, at startup

# Group every call in one conversation under the id you already use for it
with generalcontext.session(conversation_id, user_id=customer_id, channel="chat"):
    reply = handle(message)

generalcontext.flush()   # before a serverless function, job or script exits

If your app serves several companies of its own, pass account= to session() (the id or name you already use for that company) so conversations are grouped by account.

initialize() records every call these clients make in the process, sync and async, streamed or not, from clients created before or after it. Call it in every process, including workers.

Provider Client
OpenAI, including Azure OpenAI openai (chat completions and responses, with parse and stream)
Anthropic, including Bedrock and Vertex anthropic (messages and beta messages)
Google Gemini google-genai
AWS Bedrock Converse boto3 bedrock-runtime (converse, converse_stream)
Anything else Send OpenTelemetry

Voice (OpenAI Realtime). Connections from client.realtime.connect() (sync and async, needs openai[realtime]) are recorded too. Open the connection inside session(...) and the whole call lands in that conversation. Each response.done is recorded as one openai-realtime call shaped like a Responses call: the instructions and tools, the conversation so far as text (caller turns from the input transcription, agent turns from the output transcript, tool calls and their results), and a voice field with speech_stopped_at, first_audio_at, interrupted and truncated_at_ms. Turn on input audio transcription in the session to record what the caller said. Audio is never recorded. Pass a connection to wrap() to record only that one.

Python 3.9 to 3.13. Supported client versions, redaction, outcomes and events, and every option: SDK reference.

Run your benchmark

Each task runs anywhere, with no access to your systems: it carries what your agent's tools returned in production, a model plays the person, and a judge grades the rubric for a reward from 0 to 1.

pip install generalcontext openai anthropic
generalcontext benchmark pull --out benchmark.json   # needs a key that can run the benchmark
generalcontext evals run benchmark.json --agent my_agent:handle --trials 3 --upload

my_agent:handle is your agent, called as handle(messages, toolbox). See Tasks and environments and the command line.

License

Apache License 2.0. See LICENSE and NOTICE.

Metadata

Release files for generalcontext 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for generalcontext 0.3.0
File Size Uploaded Provenance Actions
generalcontext-0.3.0.tar.gz 66.5 kB With provenance Details for generalcontext-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for generalcontext 0.3.0
File Interpreter ABI Platform Actions
generalcontext-0.3.0-py3-none-any.whl Python 3 none any Details for generalcontext-0.3.0-py3-none-any.whl

Total release size: 110.7 kB

Release files / generalcontext-0.3.0.tar.gz

Download URL generalcontext-0.3.0.tar.gz
Size 66.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4a6ed793dfb6ff7d3a85ee8379a84e5d0cf3064e26736a1d6dc4c358d1954287
BLAKE2b-256 checksum
How to use checksums
158021065bd774561107159740cdbc94ec93fe56935f5373b8967a430d90a8d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / generalcontext-0.3.0-py3-none-any.whl

Download URL generalcontext-0.3.0-py3-none-any.whl
Size 44.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b03d628fb80b44357a742cbd4ebaf0623afa6824e6490cdda46210a541f81e6
BLAKE2b-256 checksum
How to use checksums
0414f56968ce66b456d451e0e5f2075bfa5991d4c994aea776069b10348fb1fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for generalcontext 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for generalcontext-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page