Skip to content

Commit cd86917

Browse files
authored
Merge pull request #6 from aptabase/ralph/llms-txt-agent-discovery
Add llms.txt for AI agent discoverability
2 parents a3e37fc + e15c2bd commit cd86917

File tree

2 files changed

+112
-1
lines changed

2 files changed

+112
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,6 @@ uv run mypy .
155155

156156
## License
157157

158-
[MIT License](LICENSE)
158+
[MIT License](LICENSE)
159+
160+
For AI/LLM integration instructions, see [llms.txt](./llms.txt)

llms.txt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Aptabase Python SDK
2+
3+
> Privacy-first, open-source analytics for Python applications. Fully async, built with httpx and asyncio. Requires Python 3.11+. GDPR-compliant. No personal data collection.
4+
5+
Package: `aptabase` on PyPI
6+
Repository: https://github.com/aptabase/aptabase-python
7+
8+
## Installation
9+
10+
```bash
11+
pip install aptabase
12+
# or
13+
uv add aptabase
14+
```
15+
16+
## Quick Start (Context Manager)
17+
18+
```python
19+
import asyncio
20+
from aptabase import Aptabase
21+
22+
async def main():
23+
async with Aptabase("A-EU-1234567890") as client:
24+
await client.track("app_started")
25+
await client.track("user_action", {"button": "login", "screen": "home"})
26+
27+
asyncio.run(main())
28+
```
29+
30+
## Quick Start (Manual Lifecycle)
31+
32+
```python
33+
client = Aptabase("A-EU-1234567890")
34+
await client.start()
35+
try:
36+
await client.track("app_started")
37+
finally:
38+
await client.stop() # Flushes remaining events
39+
```
40+
41+
## Track Events
42+
43+
```python
44+
# Simple event
45+
await client.track("page_view")
46+
47+
# Event with properties (str, int, float values)
48+
await client.track("purchase", {
49+
"product_id": "abc123",
50+
"price": 29.99,
51+
"currency": "USD"
52+
})
53+
```
54+
55+
## Configuration
56+
57+
```python
58+
client = Aptabase(
59+
app_key="A-EU-1234567890", # Required. Format: A-{EU|US|SH}-{ID}
60+
app_version="1.2.3", # App version string (default: "1.0.0")
61+
is_debug=False, # Enable debug mode (default: False)
62+
max_batch_size=25, # Max events per batch, max 25 (default: 25)
63+
flush_interval=10.0, # Auto-flush interval in seconds (default: 10.0)
64+
timeout=30.0, # HTTP request timeout in seconds (default: 30.0)
65+
base_url="https://self.host", # Required for self-hosted (A-SH-* keys)
66+
)
67+
```
68+
69+
| Parameter | Type | Default | Description |
70+
|---|---|---|---|
71+
| app_key | str | (required) | App key from Aptabase dashboard |
72+
| app_version | str | "1.0.0" | Your application version |
73+
| is_debug | bool | False | Debug mode flag |
74+
| max_batch_size | int | 25 | Max events per flush batch (hard max: 25) |
75+
| flush_interval | float | 10.0 | Seconds between auto-flushes |
76+
| timeout | float | 30.0 | HTTP request timeout in seconds |
77+
| base_url | str | None | Custom API URL (required for A-SH-* keys) |
78+
79+
## Error Handling
80+
81+
```python
82+
from aptabase import Aptabase, AptabaseError, NetworkError, ConfigurationError
83+
84+
try:
85+
async with Aptabase("A-EU-1234567890") as client:
86+
await client.track("event")
87+
except NetworkError as e:
88+
print(f"Network error: {e}, status: {e.status_code}")
89+
except ConfigurationError as e:
90+
print(f"Config error: {e}")
91+
except AptabaseError as e:
92+
print(f"Aptabase error: {e}")
93+
```
94+
95+
## Platform Notes
96+
97+
- Fully async — all methods are `async`/`await`
98+
- Requires Python 3.11+
99+
- Uses `httpx` for HTTP requests
100+
- Events are auto-batched and flushed every `flush_interval` seconds
101+
- Sessions auto-rotate after 1 hour of inactivity
102+
- Use context manager (`async with`) for automatic start/stop lifecycle
103+
- `flush()` can be called manually to force-send queued events
104+
- `stop()` flushes remaining events and closes the HTTP client
105+
- App key region determines API endpoint: `A-EU-*` → EU servers, `A-US-*` → US servers, `A-SH-*` → self-hosted (requires `base_url`)
106+
107+
## Cross-Discovery
108+
109+
For all Aptabase SDKs and documentation, see: https://aptabase.com/llms.txt

0 commit comments

Comments
 (0)