Skip to main content

AdaptKit

AdaptKit learns how the user wants the agent to behave, and iteratively improves based on their feedback. You define a few behaviors such as "explanation first", "concise responses", etc. AdaptKit only picks an action key. You decide what that key means, and your app sends the instruction to the model.

Under the hood it is per-user Thompson Sampling.

choose action → map to instruction → agent responds → observe feedback → update

This SDK doesn't wrap your agent or rewrite your prompts, and the built-in stores don't save prompts or responses.

Why??

Many times users want different things/behaviors from the same agent. People are different and thus learn and work differently from one another, so I created an SDK to help an agent adapt to each user.

Install

pip install adaptkit
# with the OpenAI examples:
pip install 'adaptkit[evaluation]'

Quick start

from adaptkit import Profile, SQLiteStore
 
instructions = {
    "patch_first": "Show the code fix first, then explain briefly.",
    "explanation_first": "Explain the cause first, then show the fix.",
}
 
profile = Profile(
    user_id="user-123",
    actions=tuple(instructions),
    store=SQLiteStore("adaptkit.db"),
)
 
decision = profile.choose("debugging")
response = agent.run(prompt, system_instruction=instructions[decision.action])

 
profile.like(decision, idempotency_key="thumbs-up-456")

How does it Learn?

Each (user, context, action) starts at $\mathrm{Beta}(1,1)$, and each piece of feedback is a binary reward $r \in \lbrace 0,1\rbrace$ for the chosen action.

$$\alpha \leftarrow \alpha + r, \qquad \beta \leftarrow \beta + (1-r)$$

In AdaptKit the contexts are independent - users can have different action preferences dependent on the context. Feedback is always about the chosen action.

Feedback Sources

  • Explicit: like(), dislike(), and pairwise prefer().
  • Implicit: observe() runs an LLM judge on the user's next message. Only comments about behavior update the policy. Comments about the answer's content, follow-up tasks, or unrelated messages are ignored, as are low-confidence judgments.
  • Passive: signal() lets your app turn telemetry (regenerations, tool approvals) into positive or negative evidence.
  • Prompt cues: an optional extractor can honor explicit requests like "walk me through it" on the first turn, before any history exists.

Every update takes an idempotency key, so retries never double-count.

Set learning_mode="shadow" to record feedback without changing the policy.

Benchmarks

The LLM judge and prompt router were tested on hand-labeled datasets (120 and 80 cases) with fixed calibration/holdout splits, 3 runs each on gpt-5.6-terra:

  • Feedback judge: the LLM classifier behind observe(). It reads the user's next message and decides whether it's feedback about the chosen behavior, and if so, whether it's positive or negative.
  • Prompt router: the optional cue extractor. It spots explicit style requests in the user's prompt (like "walk me through it") and picks the matching action directly.
Threshold Holdout result Safety
Feedback judge 0.95 95.4% detection, 99.2% direction 0 harmful updates
Prompt router 0.70 97.8% cue routing, 100% precision 0 wrong overrides

These are small synthetic sets, not production accuracy. Calibrate thresholds for your own model and traffic. Details are in artifacts/ and benchmarks/.

Try it

python -m examples.interactive_personalization          # offline, free
python -m examples.interactive_personalization --real   # uses OpenAI via .env

Tell it "please put the code first," then run /state to watch the posterior move.

Limitations

  • One action set per profile, discrete contexts, no generalization across contexts
  • Binary rewards with immediate attribution only
  • SQLite is single-host

More detail: architecture guide, examples.

Future Work

  • Expand to allow for multiple action sets per profile
  • Support a continuous reward function (instead of binary as is now)

MIT License

Metadata

Release files for adaptkit 0.1.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 adaptkit 0.1.0
File Size Uploaded Provenance Actions
adaptkit-0.1.0.tar.gz 91.1 kB With provenance Details for adaptkit-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 126.1 kB

Release files / adaptkit-0.1.0.tar.gz

Download URL adaptkit-0.1.0.tar.gz
Size 91.1 kB
Tags Source
SHA-256 checksum
How to use checksums
abe8e49ad62f5ed41994bfc1909c8a6b842229e632290a1351ddc8b715070a91
BLAKE2b-256 checksum
How to use checksums
1e7a8b78fdf259473391316a4a38d4231340873a4a34500cbc44769429657e14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 17, 2026.

Transparency log

Release files / adaptkit-0.1.0-py3-none-any.whl

Download URL adaptkit-0.1.0-py3-none-any.whl
Size 35.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43b72ba81336eeeecd3dec545fbd2c6468f682561eb3fec45cdc891482594442
BLAKE2b-256 checksum
How to use checksums
508a80f1db678836193b625b07d8033aa80b023e56d4f08a02853cd602e0778c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 17, 2026.

Transparency log

Security for adaptkit 0.1.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 adaptkit-0.1.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 Sep 17, 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.1.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