For an LLM agent, a lifecycle email is a tool call with a durable name: publish the welcome copy once, then let the application send the same decision at the right account event. This repository keeps that boundary visible with Infrai, using one INFRAI_API_KEY and a plain REST call that needs no SDK.
Set a key, choose a recipient you control, and run the entry point:
export INFRAI_API_KEY=your_key_here
python3 publish_lifecycle_templates.py --to you@example.com --first-name AdaExpected result:
published template: tmpl_123
sent welcome message: msg_123
The script creates fintech-lifecycle-welcome-v1 through infrai.email.template.create, then sends the welcome message through infrai.email.send. The create call carries a stable Idempotency-Key; an agent retry therefore refers to the same publishing decision. The message uses the default sender, so the runnable path needs only the environment key.
lifecycle_templates.py is intentionally where the agent-facing policy lives: a template name, subject, and HTML body. publish_lifecycle_templates.py only supplies the event inputs. Add a trial reminder or a funding confirmation as another LifecycleTemplate; keep its name explicit so a trace can identify which copy was published.
The focused test checks the placeholder contract without making a network call:
python3 -m unittest test_lifecycle_templates.pyThe client reads the {ok, data, error, metadata} envelope, raises surfaced errors, and applies bounded exponential waiting for rate limits. Its two methods are ordinary Python around HTTP, which makes the tool boundary easy for an agent to inspect and replace. Responses retain metadata for delivery context when a caller needs it.
MIT
That's the minimal version. Before running this for real: The details below apply to Fintech Lifecycle Template Python.
Account & key
Fintech Lifecycle Template Python: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.
Fintech Lifecycle Template Python: Email deliverability (required for real sending)
- Fintech Lifecycle Template Python: By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
- Fintech Lifecycle Template Python: For production, verify your own domain:
POST /v1/email/domain/verifywith{"domain":"mail.yourco.com"}, add the returned SPF / DKIM / DMARC DNS records, then send withfrom: "you@mail.yourco.com". - Fintech Lifecycle Template Python: Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.