Agnes ships two official SDKs:Documentation Index
Fetch the complete documentation index at: https://docs.lasscyber.com/llms.txt
Use this file to discover all available pages before exploring further.
- Python —
agnes-securityon PyPI. - TypeScript —
@lasscyber/agnes-securityon npm.
https://api.lasscyber.com), share one
OpenAPI contract, and expose the same ergonomic surface:
Agnes/AsyncAgnes(Python) andAgnes(TypeScript) — the primary client.analyze()— single hero call that returns a typedDecision.guard()— context that wraps an LLM call withcheck_input/check_outputand auto-flips inbound ↔ outbound policies.PolicyBuilder— fluent builder for combined policies in code.- Typed errors mapping 1:1 to the canonical error codes.
- Pagination helpers for resource list endpoints.
- A
raw/agnes.rawescape hatch that exposes the auto-generated low-level client for any endpoint not yet wrapped by the ergonomic surface. - Optional OpenAI drop-in integration via a separate subpath export.
Surface comparison
| Concept | Python | TypeScript |
|---|---|---|
| Client | Agnes() / AsyncAgnes() | new Agnes() |
| Analyze | agnes.analyze("...", policy="...") | await agnes.analyze("...", { policy: "..." }) |
| Guard | with agnes.guard(policy="...") as guard: | const guard = agnes.guard({ policy: "..." }) |
| Policy builder | PolicyBuilder("name").prompt_injection_jailbreak(...).build() | new PolicyBuilder("name").promptInjectionJailbreak(...).build() |
| Pagination | for x in agnes.policies.list(): ... | for await (const x of agnes.policies.list()) { ... } |
| Errors | Blocked, RateLimitError, … | Blocked, RateLimitError, … |
- Python —
snake_caseeverywhere. Canonical analyzer names use underscores (prompt_injection_jailbreak). - TypeScript —
camelCaseeverywhere. Canonical analyzer names drop the dashes (promptInjectionJailbreak).
Choosing an SDK
- Python for backend services, ML pipelines, scripts, and
notebooks. Both sync (
Agnes) and async (AsyncAgnes) clients are shipped; pick whichever matches your service. - TypeScript for browser apps (your dashboard talking to your service that wraps Agnes), server-side Node, edge runtimes (Cloudflare Workers, Vercel Edge, Deno, Bun), and front-end build pipelines. The default entry is fully isomorphic.
ak_* Agnes API key into a browser bundle —
treat keys as secrets. The TypeScript SDK’s edge-runtime support is
about server-side / worker-side environments, not “drop the key in
your React app”.
Installation
Authentication
Both SDKs readAGNES_API_KEY from the environment by default. See
Authentication for the full table of
ways to pass keys, including Agnes-Version pinning.
Compatibility
- Python: 3.9+ supported. Type stubs ship with the package.
- TypeScript: Node 18+, browsers, Deno, Bun, Cloudflare Workers. No Node-specific imports in the default entry.
Versioning
The SDKs follow Semantic Versioning, and each language SDK versions independently from the server’s date-based API contract. See Versioning for the full lifecycle and the analyzer-name evolution rules.Where next
- Python SDK — quickstart, errors, pagination, OpenAI drop-in.
- TypeScript SDK — same content for the TypeScript world.
- Versioning — SemVer for SDKs, dates for the server.
- Sandbox mode — exercise either SDK in CI without billing.