Repository navigation
feat(agent-vault): add Agent Vault proxies and sessions - #65
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
💬 Discussion in Slack: #pr-review-python-sdk-official-65-feat-agent-vault-add-agent-vault-proxies-and-se Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel. |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. It adds about 500 lines of new public SDK surface, including calls that issue proxy and session tokens, and it changes the shared InfisicalRequests.patch helper, so a human look at the API shape would still be worthwhile.
What was reviewed:
patch(nullable_keys=...): other callers still haveNonevalues dropped.clear_allowed_hostssendsallowedHosts: nullonly when set, and it raises if combined withallowed_hosts.- Request mapping in
agent_vault.py: enums and strings convert to.value, host lists and status lists are joined with commas, and query params left asNoneare omitted byrequests. - Response models: the nested actor and access-bundle parsing goes through
BaseModel.from_dict, which ignores unknown keys and handles a missingactor.
Extended reasoning...
The change adds a new AgentVault resource (proxies and sessions) in infisical_sdk/resources/agent_vault.py and its response models and enums in api_types.py. It wires the resource into the client and adds an opt-in nullable_keys parameter to the shared PATCH helper. Its security-sensitive surface is the SDK calls that create and rotate proxy tokens and session tokens. The SDK only passes these tokens through, and the server enforces authorization. The change is a sizeable new public API with no accompanying tests in the repo, so a human should confirm the method signatures and defaults, such as the required label argument on sessions.update, before they become public.
[Medium impact] The PR appears safe to merge; no actionable issues remain from this review.
|
…ed the server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d sessions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Context
The SDK had no way to manage Agent Vault. This adds
client.agent_vault, with two sub-clients:client.agent_vault.proxies:list,create,update,delete,rotate_token, andrevokeclient.agent_vault.sessions:list,get,create,update, andrevoke, including the session labels from feat(agent-vault): optional label on sessions infisical#8793 (an optionallabeloncreate, andupdateto change or remove it)Other changes:
api_types.py, and theAgentVaultTrafficPolicy,AgentVaultSessionStatus, andAgentVaultSessionScopeenums, exported frominfisical_sdkInfisicalRequests.patchtakesnullable_keys, so a request can sendnullto clear a field, whichproxies.update(clear_allowed_hosts=True)andsessions.update(label=None)need. Withoutnullable_keysit dropsNonevalues as before, so the other resources'updatemethods are unchanged.sessions.updatetakeslabelas a required argument and sendsNoneasnull. The API requires the key so that leaving it out can't remove a label by accident.sessions.createandproxies.createuse a newInfisicalRequests.post_once, which only retries aConnectTimeout, when the request never left the client. If a response is lost after the server handled the request,post_onceraises the error instead of retrying. A retry would create a second session, or fail on the proxy name and hide the proxy that was created. All other requests still retry every network error.tests/, use a mocked HTTP session to cover null clearing inpatch, retries inpostandpost_once, and the Agent Vault clear and create calls. CI now runspython -m pytest tests, and leaves outsink/, whose scripts call a live instance.The docs are in Infisical/infisical#8988. They say these methods need
infisicalsdk1.0.19, the next patch after 1.0.18. If this ships in a different version, update the two version notes there before merging that PR.Steps to verify the change
python -m pytest tests.main, and log in with a machine identity that has the Admin role in Agent Vault.client.agent_vault.proxies.create, update it (including withclear_allowed_hosts=True), rotate its token, revoke it, and delete it.sessions.list(search=...), change the label withsessions.update, remove the label withsessions.update(session_id, None), and revoke the session.Verified locally: the 15 unit tests pass, and the two create tests fail if the creates use
postinstead ofpost_once. Every Agent Vault method also ran against a local Infisical built frommain(dbac9d761d), as one identity with the Admin role in Agent Vault and one with the Member role. All 72 checks passed. They covered every parameter, the examples in #8988, the Member restrictions (403 on admin-only calls and 404 on another identity's session), and the label rules. The server logged no errors. The flake8 checks that CI enforces pass.Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).🤖 Generated with Claude Code