Skip to content

feat(agent-vault): add Agent Vault proxies and sessions - #65

Merged
scott-ray-wilson merged 4 commits into
mainfrom
PLATFOR-887
Oct 29, 2026
Merged

scott-ray-wilson merged 4 commits into
mainfrom
PLATFOR-887

Conversation

@scott-ray-wilson

@scott-ray-wilson scott-ray-wilson commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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, and revoke
  • client.agent_vault.sessions: list, get, create, update, and revoke, including the session labels from feat(agent-vault): optional label on sessions infisical#8793 (an optional label on create, and update to change or remove it)

Other changes:

  • Models: response models for proxies and sessions in api_types.py, and the AgentVaultTrafficPolicy, AgentVaultSessionStatus, and AgentVaultSessionScope enums, exported from infisical_sdk
  • PATCH requests: InfisicalRequests.patch takes nullable_keys, so a request can send null to clear a field, which proxies.update(clear_allowed_hosts=True) and sessions.update(label=None) need. Without nullable_keys it drops None values as before, so the other resources' update methods are unchanged.
  • Required label on update: sessions.update takes label as a required argument and sends None as null. The API requires the key so that leaving it out can't remove a label by accident.
  • No repeated creates: sessions.create and proxies.create use a new InfisicalRequests.post_once, which only retries a ConnectTimeout, when the request never left the client. If a response is lost after the server handled the request, post_once raises 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: the repo's first unit tests, in tests/, use a mocked HTTP session to cover null clearing in patch, retries in post and post_once, and the Agent Vault clear and create calls. CI now runs python -m pytest tests, and leaves out sink/, whose scripts call a live instance.

The docs are in Infisical/infisical#8988. They say these methods need infisicalsdk 1.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

  1. Run python -m pytest tests.
  2. Run Infisical from main, and log in with a machine identity that has the Admin role in Agent Vault.
  3. Create a proxy with client.agent_vault.proxies.create, update it (including with clear_allowed_hosts=True), rotate its token, revoke it, and delete it.
  4. Create a session with a label, find it with sessions.list(search=...), change the label with sessions.update, remove the label with sessions.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 post instead of post_once. Every Agent Vault method also ran against a local Infisical built from main (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

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Updated AGENTS.md files (if needed)
  • Read the contributing guide

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@infisical-review-police

Copy link
Copy Markdown

💬 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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 have None values dropped. clear_allowed_hosts sends allowedHosts: null only when set, and it raises if combined with allowed_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 as None are omitted by requests.
  • Response models: the nested actor and access-bundle parsing goes through BaseModel.from_dict, which ignores unknown keys and handles a missing actor.
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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no actionable issues remain from this review.

Summary

Adds client.agent_vault for managing proxies and sessions.

  • Callers can manage Agent Vault proxies through the SDK.
  • Callers can manage Agent Vault sessions through the SDK.
  • Shared requests can send clear values without repeating one-time actions.

Both earlier concerns are addressed: creation uses post_once, and checked-in tests cover nullable updates and run in CI. No new actionable issues were found.

Reviews (3) · Last reviewed commit: "fix(agent-vault): address review on host..." · Reviewed by Greptile

Comment thread infisical_sdk/resources/agent_vault.py Resolved
Comment thread infisical_sdk/infisical_requests.py Resolved
scott-ray-wilson and others added 2 commits October 27, 2026 18:01
…ed the server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear

linear Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

AGE2-178

AGE2-266

Comment thread infisical_sdk/api_types.py Resolved
Comment thread infisical_sdk/resources/agent_vault.py Resolved
Comment thread infisical_sdk/resources/agent_vault.py Resolved
…d sessions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scott-ray-wilson
scott-ray-wilson merged commit 89fb9f8 into main Oct 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants