agentsim-sdk
AgentSIM is the control plane for agents hitting the real world's auth walls. SMS OTP is the first challenge type. This SDK provisions a US test number, waits for the parsed code, and releases the session. Local mock mode accepts inbound messages through the REST API.
Install
uv add agentsim-sdk
Or with pip:
pip install agentsim-sdk
Quickstart
import agentsim
async with agentsim.provision(agent_id="checkout-bot", country="US") as num:
await enter_phone_number(num.number) # "+12025550142"
otp = await num.wait_for_otp(timeout=60)
await enter_otp(otp.otp_code) # "391847"
# number auto-released
Auth
Set AGENTSIM_API_KEY in your environment, or call agentsim.configure() at startup:
agentsim.configure(api_key="asm_live_xxx")
Get your API key at console.agentsim.dev.
API
agentsim.provision(*, agent_id, country="US", service_url=None, ttl_seconds=3600, webhook_url=None)
Returns an async context manager. Provisions a number on enter, auto-releases on exit (even if the body raises).
async with agentsim.provision(agent_id="checkout-bot", country="US") as num:
print(num.number) # E.164 phone number
print(num.session_id)
otp = await num.wait_for_otp(timeout=30)
print(otp.otp_code)
num.wait_for_otp(timeout=60, auto_reroute=False, max_reroutes=2, on_reregistration_needed=None)
Long-polls until an OTP arrives or timeout seconds elapse.
Returns: OtpResult(otp_code, from_number, received_at)
Raises: OtpTimeoutError if no OTP arrives within timeout seconds.
Set auto_reroute=True to automatically provision a replacement number in another country if no OTP arrives. on_reregistration_needed is an async callback (new_number: str, country: str) -> None called when re-registration on the target service is required.
agentsim.provision_sync(...) / num.wait_for_otp_sync(timeout=60)
Synchronous variants for non-async codebases:
with agentsim.provision_sync(agent_id="x") as num:
otp = num.wait_for_otp_sync(timeout=60)
Error Reference
| Exception | When |
|---|---|
AuthenticationError |
Missing or invalid API key |
PoolExhaustedError |
No numbers available in requested country |
OtpTimeoutError |
No OTP arrived within timeout seconds |
RateLimitError |
Too many requests — back off and retry |
SessionNotFoundError |
Session expired or already released |
CountryNotAllowedError |
Country not available on current plan |
Supported Countries
US
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentsim_sdk-0.22.0.tar.gz.
File metadata
- Download URL: agentsim_sdk-0.22.0.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1df5e8b1e6c30418bc9149af12bc8b91e19532c4f022bbbfc190acd813eb64a6
|
|
| MD5 |
f7227d750d5c0c4d54c6f462b1fa3a74
|
|
| BLAKE2b-256 |
6cfc5fbbd80daef09ff32bc7baf172222898fe29f89eecafeabcc16c219a5caa
|
Provenance
The following attestation bundles were made for agentsim_sdk-0.22.0.tar.gz:
Publisher:
publish-pypi.yml on agentsimdev/agentsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentsim_sdk-0.22.0.tar.gz -
Subject digest:
1df5e8b1e6c30418bc9149af12bc8b91e19532c4f022bbbfc190acd813eb64a6 - Sigstore transparency entry: 2582033775
- Sigstore integration time:
-
Permalink:
agentsimdev/agentsim@7e28a1597020d53d2fa54c9e88ea89b909316a12 -
Branch / Tag:
refs/tags/v0.22.0 - Owner: https://github.com/agentsimdev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@7e28a1597020d53d2fa54c9e88ea89b909316a12 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentsim_sdk-0.22.0-py3-none-any.whl.
File metadata
- Download URL: agentsim_sdk-0.22.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069554c38ece1227941748312108d4d58251fe22846fea8344d85e022ed491fd
|
|
| MD5 |
4ddc4f27955dcd63296bdc8ee5bb666c
|
|
| BLAKE2b-256 |
b1c2721a174b435da845737ada21b9fe3d4cbe3a3539d9a58daaff98f921490f
|
Provenance
The following attestation bundles were made for agentsim_sdk-0.22.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on agentsimdev/agentsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentsim_sdk-0.22.0-py3-none-any.whl -
Subject digest:
069554c38ece1227941748312108d4d58251fe22846fea8344d85e022ed491fd - Sigstore transparency entry: 2582033779
- Sigstore integration time:
-
Permalink:
agentsimdev/agentsim@7e28a1597020d53d2fa54c9e88ea89b909316a12 -
Branch / Tag:
refs/tags/v0.22.0 - Owner: https://github.com/agentsimdev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@7e28a1597020d53d2fa54c9e88ea89b909316a12 -
Trigger Event:
release
-
Statement type: