Authsome is a Python library as well as a CLI. The public surface lives in the top-levelDocumentation Index
Fetch the complete documentation index at: https://authsome.agentr.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
authsome package.
The supported integration surface for almost every workflow is the CLI plus the proxy (
uvx authsome run -- <your agent>). The library exists for embedding authsome inside a larger Python orchestrator with custom storage, custom subprocess management, or per-call connection selection that the proxy can’t yet do. If you’re not in that case, the CLI is the right tool. See Run agents with the proxy.Install
Quick start
create_auth_service(..., identity="<handle>") is the same constructor the daemon uses after it has validated a registered identity handle. It reads ~/.authsome/config.json, opens the vault scoped to that identity, wires the provider registry, and returns an AuthService.
To target a non-default home directory:
Public exports
Everything below is re-exported from the top-levelauthsome package:
AuthService
The class that owns OAuth flows, token refresh, and the login/logout/revoke lifecycle. It receives aVault, a ProviderRegistry, and an AppStore as dependencies. For most library use, build it with create_auth_service() as shown above.
Get a token or API key
get_access_token checks the stored expiry, refreshes the token if it’s close to expiry (within 300 seconds), writes the fresh record back, and returns the usable string. For API-key providers the call returns the stored key value through the same code path.
For pre-built headers ready to splice into a request:
Inspect connections
List and inspect providers
Manage connections
logout removes a single local connection. revoke calls the provider’s revocation endpoint (where supported) and clears all connections + client credentials for the provider in the active profile. remove uninstalls the provider definition entirely (for custom providers) or resets it to the bundled default.
Run a login flow
Most library users rely on the CLI for login because the flows need a browser or a TTY. To drive a flow programmatically:uvx authsome login and reading its --json output.
Profiles
--profile switching is not yet wired up. The library is the supported way to manage profiles programmatically today.
Register a custom provider
uvx authsome register ./acmecrm.json. The schema is documented in Provider schema.
AuthLayer
A thin facade that holds the building blocks (vault(), registry(), identity(), app_store()). Useful when you need direct access to one component without going through the full AuthService surface . for example, reading a credential record without triggering refresh.
AuthService is the right entry point. Drop down to AuthLayer and Vault directly only when you’re embedding authsome inside a larger orchestrator with custom storage.
Vault
A minimal key-value interface with field-level encryption applied transparently:AuthService; it manages encryption, decryption, and connection lifecycle for you.
Errors
All exceptions subclassAuthsomeError. Common ones you’ll catch:
| Exception | When |
|---|---|
ProviderNotFoundError | get_provider("does-not-exist") |
ConnectionNotFoundError | Requested connection doesn’t exist on the provider |
CredentialMissingError | Provider is registered but no connection has been completed |
RefreshFailedError | Provider rejected the refresh token |
TokenExpiredError | Token expired and refresh wasn’t possible |
AuthenticationFailedError | Login flow returned an error or the user cancelled |
InputCancelledError | User cancelled credential entry |
StoreUnavailableError | Vault file is locked or unreadable |
EncryptionUnavailableError | OS keyring backend unreachable in keyring mode |
ProfileNotFoundError | Active profile doesn’t exist |
InvalidProviderSchemaError | register_provider got a malformed ProviderDefinition |
When to use the library vs the CLI
| Use the library | Use the CLI |
|---|---|
| Embedding authsome in an existing Python agent. | Driving authsome from any non-Python runtime. |
| Fine-grained per-call connection selection. | Default-connection model is enough. |
| Reading connection metadata without parsing CLI output. | --json output is enough. |
| Stubbing the vault or auth layer in tests. | You’re a human running commands. |
uvx authsome run -- <agent> is simpler than embedding the library directly. The library exists for cases where the CLI shape doesn’t fit.
What’s next
Architecture
Where AuthService and Vault sit in the layered model.
CLI reference
Every command. The CLI is a client of the same code.
Provider schema
Fields on a ProviderDefinition.
Filesystem layout
Where the library reads and writes.