Skip to content

Commit ab3673d

Browse files
committed
docs: add AGENTS.md for AI coding assistants
Provides structured context for AI agents (Cursor, Claude Code, Codex) working with the Courier Python SDK: core send pattern, key rules (routing defaults, profile merge vs replace, idempotency, bulk flow), concept definitions, and links to full docs/MCP/skills.
1 parent 3457eff commit ab3673d

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Courier Python SDK
2+
3+
Courier is a notifications API for sending messages across email, SMS, push, in-app inbox, Slack, and WhatsApp from a single API call.
4+
5+
## Setup
6+
7+
```python
8+
from courier import Courier
9+
10+
client = Courier() # reads COURIER_API_KEY from env
11+
```
12+
13+
For async usage, use `AsyncCourier` and `await`.
14+
15+
## Core pattern
16+
17+
```python
18+
response = client.send.message(
19+
message={
20+
"to": {"user_id": "user_123"},
21+
"template": "TEMPLATE_ID",
22+
"data": {"order_id": "456"},
23+
"routing": {"method": "single", "channels": ["email", "sms"]},
24+
},
25+
)
26+
27+
print(response.request_id)
28+
```
29+
30+
## Key rules
31+
32+
- Use `routing.method: "single"` (fallback chain) unless the user explicitly asks for parallel delivery (`"all"`).
33+
- Use `client.profiles.create()` for partial profile updates (it merges). Use `client.profiles.replace()` only when fully replacing all profile data.
34+
- Test and production use different API keys from the same workspace. Always confirm which environment before sending.
35+
- For transactional sends (OTP, orders, billing), pass an `Idempotency-Key` header via `extra_headers` to prevent duplicates.
36+
- Bulk sends are a 3-step flow: `client.bulk.create()``client.bulk.add_users()``client.bulk.run()`.
37+
- `request_id` from a single-recipient send doubles as the `message_id`. For multi-recipient sends, each recipient gets a unique `message_id`.
38+
39+
## Concepts
40+
41+
- `template` — notification template ID from the Courier dashboard
42+
- `routing.method``"single"` = try channels in order until one succeeds; `"all"` = send on every channel simultaneously
43+
- `tenant_id` — multi-tenant context; affects brand and preference defaults for the message
44+
- `list_id` — send to all subscribers of a named list
45+
- `to.email` / `to.phone_number` — ad-hoc recipient (no stored profile needed)
46+
- `to.user_id` — registered user whose profile has channel addresses
47+
48+
## More context
49+
50+
- Full docs index: https://www.courier.com/docs/llms.txt
51+
- API reference: https://www.courier.com/docs/reference/get-started
52+
- MCP server: https://mcp.courier.com
53+
- Courier Skills (Cursor / Claude Code): https://github.com/trycourier/courier-skills

0 commit comments

Comments
 (0)