pydantic-ai-asyntai
A Pydantic AI capability for Asyntai, the AI chat agent for websites.
Point Asyntai at a website. It reads the pages, the product feed and the documents, and keeps them current. AsyntaiCapability hands that knowledge to any Pydantic AI agent, together with the website's chats and leads. Your agent answers questions about a real business without you building or maintaining an index.
Full guide: asyntai.com/documentation/integrations/pydantic-ai
Install
pip install pydantic-ai-asyntai
Set the key
Create an API key in the Asyntai dashboard under Settings → API. The API is available on the Starter plan and higher.
export ASYNTAI_API_KEY="your-key"
Use it
from pydantic_ai import Agent
from pydantic_ai_asyntai import AsyntaiCapability
agent = Agent('anthropic:claude-sonnet-4-5', capabilities=[AsyntaiCapability()])
result = agent.run_sync('Do they ship to Spain, and how long does it take?')
print(result.output)
The capability adds tools and a short instruction that tells the model to ask the website instead of guessing. Each run starts its own website conversation, and follow-up questions in the run share its context. To continue one conversation across runs, for example one per customer, pass session_id="customer-42". Every conversation also shows in your Asyntai chat logs.
The tools
| Tool | What the agent can do | On by default |
|---|---|---|
asyntai_ask_website |
Answer a question from the website: products, prices, stock, delivery, opening hours, policies, documentation. | Yes |
asyntai_list_websites |
List the website agents on the account, with their ids. | Yes |
asyntai_list_knowledge |
List the pages, texts and files the website agent knows. | Yes |
asyntai_get_leads |
Read the visitors who left an email address or a phone number. | Yes (lead_tools) |
asyntai_get_conversation |
Read the messages of one website chat. | Yes (lead_tools) |
asyntai_add_text |
Store a text so the website agent uses it in later answers. | No (knowledge_tools) |
asyntai_add_url |
Read a page into the knowledge base. | No (knowledge_tools) |
AsyntaiCapability(
website_id=42, # which website agent, when the account has several
lead_tools=False, # hide visitor contact details and chats
knowledge_tools=True, # allow writing to the knowledge base
)
Agent specs
The capability takes only plain values, so it works in agent specs:
model: anthropic:claude-sonnet-4-5
capabilities:
- AsyntaiCapability: {website_id: 42}
from pydantic_ai import Agent
from pydantic_ai_asyntai import AsyntaiCapability
agent = Agent.from_file('agent.yaml', custom_capability_types=[AsyntaiCapability])
Several websites on one agent
An agency runs one Asyntai account with one website agent per client. Give each capability its own website_id and a tool prefix:
agent = Agent(
'anthropic:claude-sonnet-4-5',
capabilities=[
AsyntaiCapability(website_id=1).prefix_tools('bakery'),
AsyntaiCapability(website_id=2).prefix_tools('bikeshop'),
],
)
Errors
A wrong argument, such as an unknown chat session_id, comes back to the model as ModelRetry, so the model can correct the call. A wrong API key, a plan without API access, or a reached message limit raises AsyntaiError and stops the run with a message you can show to a user.
Tests
pip install -e ".[test]"
pytest
tests/test_live.py runs against a real account when ASYNTAI_LIVE_KEY and ASYNTAI_LIVE_URL are set.
License
MIT
Metadata
Release files for pydantic-ai-asyntai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydantic_ai_asyntai-0.1.0.tar.gz | 12.0 kB | Without provenance | Details for pydantic_ai_asyntai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_ai_asyntai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_ai_asyntai-0.1.0-py3-none-any.whl |
Total release size: 20.9 kB
Release files / pydantic_ai_asyntai-0.1.0.tar.gz
| Download URL | pydantic_ai_asyntai-0.1.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff2675f1f57c333626f596bf3e63b2ec3d07d734b520766360b22cb244630eab
|
|
BLAKE2b-256 checksum How to use checksums |
9eaff721b7c12d87e413a7633db67a547ca68477549be58b4260b062110dcea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / pydantic_ai_asyntai-0.1.0-py3-none-any.whl
| Download URL | pydantic_ai_asyntai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9a2dab226c4f6f0afb9d2f3d810267d5c92022d318ed71a21b47d2d4a166181
|
|
BLAKE2b-256 checksum How to use checksums |
4305a477eeaab3f871aa7a06c0216f464f6624a5e3445ea91854c12e1e2fcb6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for pydantic-ai-asyntai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.