Uh oh!
There was an error while loading. Please reload this page.
feat(keycardai-langchain): add Access factory API for run identity (ECO-317) - #236
Merged
Merged
Conversation
References ECO-317. Co-Authored-By: Larry Osakwe <larry@keycard.ai>
Reference: ECO-317 Co-Authored-By: Larry Osakwe <larry@keycard.ai>
ContributorAuthor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Larry-Osakwe
approved these changes
Aug 26, 2026
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ECO-317. Adds
keycardai.langchain.Access, a namespace of three factories that build theKeycardIdentityfor a run, so a call site names its access pattern instead of setting a field:Accessis not a type and not the context schema:context_schema=KeycardIdentityis unchanged everywhere,Access.__init__raisesTypeError, and directKeycardIdentity(...)construction keeps working with no deprecation warning (the existingtest_middleware.pycases still construct it directly, which is the regression proof).Validation lives in the factories, not the dataclass:
on_behalf_ofandimpersonateraiseValueErroron empty or whitespace-only input, whileKeycardIdentitystays permissive so the middleware's own identity resolution is unaffected.Docs and messages switched to the new spelling: the package README (quick start, access-pattern table,
grant()/agrant()andfallback_identitysnippets), both runnable examples and their READMEs, the middleware'smissing_identityerror text,get_access_context's RuntimeError, and thegrant()docstring examples.access.pyimports frommiddleware.pyand not the reverse, so the middleware text changes are text only, no new import edge.Docs generation:
docs/sdk/*.mdxis generated only forkeycardai.oauth,keycardai.mcp, andkeycardai.mcp.integrations.fastmcp(see thesdk-ref-*recipes in the justfile). No mdx page coverskeycardai.langchain, so there is nothing to regenerate for this change.Verification:
just test-package langchainpasses (45 tests), coverage 92.47% against the 85 gate,ruff checkandruff formatclean.just typecheckwas not run:tyis not installed in this workspace anduv run --frozen ty checkfails to spawn onmainas well.Open questions
from keycardai.langchain import Accessin each standalone snippet to keep every example copy-paste runnable. Happy to drop the repeated imports if the house preference is a single import block at the top of the README.KeycardIdentityconstruction.Link to Devin session: https://app.devin.ai/sessions/4c0f387bd7364321a2283ade1cd120a9
Requested by: @Larry-Osakwe