Skip to main content
The Nonhumans Python SDK brings your AI agent a complete digital identity without the infrastructure overhead. In a few lines of Python your agent gains a real email inbox, crypto and fiat wallet, vector memory, credential vault, LLM access, always-on compute, and more — all through a single, consistent API key.

Installation

Python 3.9 or later is required. The SDK ships with type hints throughout, so you get autocomplete and static analysis in editors like VS Code and PyCharm.

Initialization

Store your API key in an environment variable — never hardcode it. The client reads NONHUMANS_KEY automatically if you omit api_key.

Configuration options

api_key
str
required
Your agent’s API key. Retrieve it from the Nonhumans dashboard. Defaults to the NONHUMANS_KEY environment variable.
base_url
str
Override the default API base URL. Defaults to https://api.nonhumans.ai/v1.
timeout
float
Request timeout in seconds. Defaults to 30.0.
retries
int
Number of automatic retries on transient network errors. Defaults to 2.

Modules

agent.email — Email inbox

Your agent has a real email address (e.g. alice@nonhumans.ai). Read, send, and reply to messages programmatically.

agent.wallet — Crypto & fiat payments

Send and receive payments, issue invoices, and create virtual cards without wiring up a separate payments provider.

agent.memory — Vector memory & file storage

Store, retrieve, and semantically search anything your agent needs to remember across sessions.

agent.models — LLM access

Call language models through the same API key — no separate provider accounts required.

agent.compute — Always-on compute

Run code on persistent agent compute without managing infrastructure.

agent.vault — Credential vault

Securely store and retrieve API keys, tokens, and other secrets your agent needs at runtime.

agent.phone — SMS & voice calls

Your agent has a real phone number it can use to send texts and make outbound calls.

agent.web — Web presence & calendar

Register HTTP endpoints on your agent’s public subdomain and expose a bookable calendar to the world.

Async support

For async frameworks like FastAPI, asyncio, or LangChain async chains, use AsyncNonhumans. Every method is await-able and the interface mirrors the sync client exactly.
Use AsyncNonhumans inside any async framework — FastAPI route handlers, Celery async tasks, or standalone asyncio scripts — without any extra configuration.

Error handling

All SDK methods raise NonhumansError on failure. Inspect status, code, and message to handle errors cleanly.
In async code, use try/except inside your async functions or attach an exception handler to your event loop to avoid silent task failures.

Full example — Recruiting agent

This example shows an agent that monitors its inbox for job applications, scores them, stores the result in memory, and sends a personalised reply.

Next steps

TypeScript SDK

Build agents in TypeScript or JavaScript with the same full-featured SDK.

CLI Reference

Scaffold, deploy, and inspect agents from the command line.