Metadata-Version: 2.4
Name: aegis-smart-accounts
Version: 0.1.2
Summary: Python SDK and resumable onboarding CLI for Aegis Smart Accounts
License: MIT
Requires-Python: >=3.10
Requires-Dist: eth-abi>=5.1
Requires-Dist: eth-account>=0.13
Requires-Dist: requests>=2.31
Requires-Dist: web3>=7.0
Description-Content-Type: text/markdown

# Aegis Python SDK

The released SDK is published as [`aegis-smart-accounts`](https://pypi.org/project/aegis-smart-accounts/).
It requires Python 3.10 or newer. Install it in an isolated environment:

```bash
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install aegis-smart-accounts
```

For repository development instead, use `python -m pip install -e sdk/python`.

The SDK never stores a private key. `aegis init` records only public identifiers
and addresses in a mode-0600 state file so an interrupted setup can resume.

```bash
export AEGIS_API_KEY=aegis_...
aegis init --name my-agent --owner 0x... --signer 0x... \
  --chain-id 11155111 --policy-file /path/to/policy.json
aegis doctor AGENT_UUID --permission-id PERMISSION_UUID --asset native
# Equivalent flag form:
aegis doctor --agent-id AGENT_UUID --permission-id PERMISSION_UUID --asset native
```

A minimal Sepolia policy example is available in the repository at
[`examples/minimal-sepolia-policy.json`](https://github.com/aegisinfra/aegis/blob/develop/sdk/python/examples/minimal-sepolia-policy.json).
Use an explicit policy file that matches the account and chain you intend to
operate on.

Use `permission_calldata(permission_id, calldata)` to create the exact Aegis
permission envelope. Never select a permission by “newest”; pass the permission
UUID or on-chain bytes32 ID explicitly and run doctor immediately before use.

`build_execute` and `build_execute_batch` encode policy-only account calls.
`estimate_userop` preserves the bundler's raw `RpcError.data` for diagnosis and
fails before RPC when the UserOperation has no signature; `sign_userop` uses
the EIP-191 encoding expected by the account; and `submit_userop` sends the
fully estimated and signed v0.6 operation. This prevents an unsigned
simulation from being misreported as an AA21 prefund failure.
Use `wait_for_userop_receipt` after submission. It reads the mined transaction
hash from the nested `receipt.transactionHash` field and exposes it as
`tx_hash`; the top-level `userOpHash` is not an EVM transaction hash.

When checking an intended token, pass `--asset <address>` (or `native`) to
Doctor. Doctor's normal asset rows describe the permission's configured asset
list; an account holding a token does not by itself mean that token is allowed
by the permission.
