Skip to main content
Python integrates through the Execution Fabric REST API. Use HTTPX in a trusted service or worker; browser and mobile clients should call your application backend instead.

Prerequisites

Before you begin, prepare:
  • a trusted server runtime and application authentication boundary;
  • a disposable personal workspace Praxa key with only the tutorial’s required scopes;
  • synthetic input plus a persisted application request ID for replay tests;
  • a fake upstream for unit tests and a non-production environment for canaries;
  • an acceptance assertion that proves the reusable HTTPX client admits and reconciles one task with bounded errors.

1. Install the client

2. Build a typed client

praxa_client.py
Reuse the AsyncClient; do not create it in a hot loop. HTTPX enforces timeouts by default, and explicit connect/overall values make your operational contract clear.

3. Use it from a service

In a long-running application, create the client during startup and close it during shutdown.

4. Test without the network

test_praxa_client.py
Add tests for invalid input, missing authentication in your web framework, under-scoped responses, conflict handling, timeout reconciliation, and secret redaction.

5. Verify end to end

  1. Submit one disposable task.
  2. Persist its request body digest, idempotency key, and run ID.
  3. Poll with get_run until completed, failed, or cancelled.
  4. Replay the exact task and require the same logical run.
  5. Revoke the key and require the next call to fail.
  6. Remove temporary files and preserve only the minimum redacted receipt.

Troubleshooting

Best practices

  • Use Pydantic or an equivalent schema at your application boundary.
  • Keep user and tenant authority out of the body.
  • Reuse clients and bound connection pools.
  • Record status/problem code, not raw sensitive bodies.
  • Use FastAPI dependency injection for authenticated principals.
  • Test with MockTransport before a disposable staging canary.

FastAPI tutorial

Put the client behind a typed FastAPI route and dependency-based auth.

HTTPX timeouts

Review current connect, read, write, and pool timeout behavior.

Optimize for production

  • Reuse one configured HTTP or SDK client per process and bound concurrent upstream work.
  • Prefer durable admission plus asynchronous readback over holding application requests open.
  • Cache only non-sensitive, tenant-scoped reads within their documented freshness window.
  • Measure p50/p95 latency, admission-to-terminal time, retries, conflicts, and connection reuse before tuning.
Optimize only after the correctness and isolation matrix passes. Lower latency or cost is not an improvement if verified outcomes, authority checks, or recovery rates regress.

Cleanup and next steps

  1. Revoke the disposable Praxa key and require a later request to fail.
  2. Remove synthetic application records and any temporary environment files.
  3. Cancel or archive unresolved test runs according to the application policy.
  4. Retain only redacted request, run, and verification identifiers needed for the test record.
After cleanup, run the shared integration test matrix and record any environment-specific check that remains pending.

Frequently asked questions

What proves this tutorial works?

The minimum observable result is that the reusable HTTPX client admits and reconciles one task with bounded errors. A compile, package import, mocked response, or initial admission alone does not prove the complete workflow.

Can a browser, mobile app, or model prompt hold the credential?

No. Browser and mobile bundles are inspectable. Keep the Praxa credential in the trusted application backend.

How should an ambiguous mutation be retried?

Persist the exact logical input and idempotency key before the first attempt. Reconcile through authoritative readback or replay the exact request with that same key before creating new work.

What should we monitor after release?

Monitor application auth failures, upstream status/code, latency, retries, replay conflicts, and terminal run outcomes. Alert on authorization bypass, cross-tenant disclosure, repeated conflicts, or cleanup failure.
Last modified on August 14, 2026