Python & FastAPI
FastAPI, async, packaging and the ORM - building and shipping Python services without the event loop or the dependency tree fighting you.
Sub-topics
FastAPI
18Routing, dependencies, validation and running it in production.
Async & Concurrency
6The event loop, blocking calls, Celery and background work.
Packaging & Environments
6pip, poetry, uv, virtualenvs and ModuleNotFoundError.
Databases & ORM
5SQLAlchemy sessions, connection pools and query patterns.
Testing
2pytest, fixtures, async tests and flaky suites.
40 articles · showing 1-9 (page 1 of 5)
Metering, model routing and the regression suite that stops your agent rotting
Two questions decide whether an AI feature survives its first year: does each request make money, and will a prompt edit break something silently? An append-only credit ledger, two-tier routing, and a suite that asserts question-to-metric mappings are the answers.
Exactly-once over an unreliable pipe: HMAC, nonces, and a byte-exact contract
A per-request nonce and a per-content hash look like the same idea and are not. One says this request arrived twice, the other says this message arrived twice, and a payment pipeline needs both. The signing design behind a production SMS gateway.
Bolting a phone onto ERPNext: custom routes, guest endpoints and HMAC auth in Frappe
Frappe claims every /api/* path before website routing, so a fixed third-party path 404s. Here is the before_request rewrite that fixes it, including the cached property you also have to bust, and why allow_guest endpoints can still be strongly authenticated.
Shipping a business agent on WhatsApp: templates, webhooks and the 24-hour window
The in-app chat panel was good and nobody opened it. Putting the agent on WhatsApp means the Cloud API's template rules, idempotent webhooks, per-tenant scheduled jobs, alert hysteresis, and testing that Sheng routes to the right metric.
Hosted brain, dumb connector: splitting an AI agent so the data never leaves the client
Ship your agent to the client and you hand over your product. Pull their data to your platform and you become the custodian of their business records. The third option is a split: a hosted brain that decides what to fetch, and an on-prem connector with no intelligence in it at all.
M-Pesa Reconciliation That Scales: From Paybill Statement to Trial Balance
Stop reconciling in spreadsheets. A three-way match between the Safaricom statement, your callback events and a double-entry ledger, with named break categories and a daily close job in Python and SQL.
M-Pesa "Invalid BusinessShortCode": The Python requests Bug Behind It
Daraja error 400.002.02 blames your shortcode, but the real cause is usually data=payload instead of json=payload in Python requests. Here is how to prove it.
MySQL server has gone away: four unrelated causes, one message
Errors 2006 and 2013 are a shrug, not a diagnosis. Idle timeouts, packet size, read timeouts and a crashed server all produce them, and each needs a completely different fix.
FATAL: sorry, too many clients already - and why raising max_connections is wrong
Every Postgres connection is a separate OS process, so raising max_connections trades a clear error for an OOM. Here is the connection maths and the PgBouncer fix.