Python
thinkery-leanctx-sdkLeanCTX SDK
LeanCTX is the Context Gateway for AI systems. Embed supported context selection, controls and evidence through native SDK interfaces. Keep your model, workflow and UI.
Inside your product
Use a local Engine or an authenticated Enterprise service. The SDK speaks the same versioned contracts for context, permissions and evidence, without duplicating the Engine inside your application.
Embed context
Prepare sources, inspect the returned view and record the host outcome with ContextSession. Recover source detail when the task needs it.
ContextSessionBuild agents
Use AgentContext for reads, search, composition and token measurements. Agent Tools can write files or run allowlisted argv commands only with explicit permissions. Your host owns model calls and agent lifecycle.
AgentContextFrom code to context
Start with context preparation: gather a project’s relevant material and inspect what your application receives. This example leaves the model call to your app. Agent Tools can run explicitly permitted, allowlisted commands through the Engine; they do not take over model inference.
compose()result.textsaved_tokensfrom leanctx_sdk import (
AgentContext
)
with AgentContext(
".",
task="Explain project"
) as ctx:
result = ctx.compose()
metrics = ctx.metrics
print(result.text)
print(metrics.saved_tokens)Requires a compatible Engine. Runs against your local project; the output depends on its files.
Language packages
Choose the native package for your stack. Negotiate versions and capabilities with the Engine, then check the operation matrix for your language and transport.
thinkery-leanctx-sdk@thinkery/leanctx-sdkgithub.com/Thinkery-AG/leanctx-sdk/packages/gothinkery-leanctx-sdkcom.leanctx:leanctx-sdkThinkery.LeanCtxHost control
Your app establishes the user and business context. The Engine enforces the request’s source, content and execution rules. Local sessions start read-only; writes and commands require explicit permission.
Connected capabilities
Stable
Prepare context or request Agent Tools actions with explicit write or execute permission. Execute only allowlisted argv commands; inspect receipts, handle typed errors and cancel an in-flight SDK session. Your host owns model calls and agent lifecycle.
Python SDK Preview
The Python SDK exposes workspace, checkpoint, delta and handoff operations in Preview under leanctx_sdk.preview. These local handoffs carry selected state and source references; the host owns agent launch, lifecycle and permissions. Broader agent orchestration remains Research.
SDK / OEM
Choose the agreement for the components you embed and the service you deliver. SDK/OEM covers commercial integration, redistribution and third-party delivery; Enterprise covers organizational operation.
The public Engine keeps its Apache rights. Additional SDK and runtime components have their own terms. A commercial agreement defines the specific rights, delivery model and support you need.
Start with LeanCTX
Install your language package, connect the Engine and prepare context for one real task.
Your application. Your model. Supported context controls inside.
Cookie settings
Your privacy. Your choice.
We count public page requests without tracking cookies or visitor IDs. Essential only also disables this server statistic for future requests. With your permission, PostHog measures clicks and reading activity. Masked recordings need a separate choice. No advertising.
Essential
Theme, consent choice and account functionality.
Cookieless server statistics
Hourly request counts, without visitor recognition. Your refusal is stored as an essential preference.
Analytics
Optional page analytics · PostHog on our server. Off until you allow it.
Session recordings
Optional replay of public-page interactions, with text and inputs masked. Requires analytics.
Your browser requests privacy protection. Analytics and recordings stay off.
Change your choice anytime in Cookie settings.