Skip to main content

AOA

Python 3.12+ Apache-2.0 CI 87 tests 3.5.1

aoa-demo: Reference Services for AOA

aoa-demo contains two runnable reference services — a FastAPI HTTP service and an MCP server — built on the same domain model: orders, products, and customers. Both services expose the same Action operations over different transports, demonstrating how a single piece of business logic is published via FastApiAdapter for REST clients and via McpAdapter for AI agents without duplicating any logic. The package also serves as the integration fixture used in the AOA test suite.

The identity domain: one connection per call, with or without a database

POST /api/v1/identity/lookup and the MCP tool identity.lookup are the reference for a database-backed resource. The action declares IdentityStoreBase under the connection key identity; the route supplies a value per call — created for the call and closed after it — so concurrent calls never share a connection and each transaction belongs to one caller. The domain asks storage for two things — a person, and a login recorded inside a transaction — and each store supplies them its own way: over PostgreSQL the domain runs its statements through the driver's protected helpers (_execute, _fetchrow) from methods of its own, and in memory it answers from dictionaries.

It runs in two modes, and only the supplied value differs:

Mode When What the route supplies
in memory AOA_DEMO_POSTGRES_DSN is unset IdentityStoreStub — the same two operations, no database, no driver
over a pool the variable names a database IdentityStore(data_source=…) — one connection per call from IdentityDataSource's pool

The identity data source, and with it the pool, is opened once when the service starts and closed when it stops. An MCP service has no request-scoped startup hook, but its server has one, so both transports pass the same pool_lifespan to build() — no wrapper to write.

# Database-free: answers from memory; needs no PostgreSQL and no driver.
uv run uvicorn aoa.demo.fastapi_mcp_services.app_fastapi_service:app --port 8000

# Over a pool: install the extra and name the database.
uv add "aoa-demo[postgres]"
AOA_DEMO_POSTGRES_DSN=postgresql://user:pass@localhost/db \
  uv run uvicorn aoa.demo.fastapi_mcp_services.app_fastapi_service:app --port 8000

The pool states its size bounds (min_size=1, max_size=10) where the data source is created; the wait for a free connection is bounded on the data source (IdentityDataSource.acquire_timeout = 30.0), because create_pool has no such parameter — a timeout= there would bound connecting, not waiting.

What each mode is for, and what the resource does with its connection, is in src/aoa/demo/model/identity/README.md.

Its databases: resources that share one store

A resource is often a part of a database rather than the whole of it. The demo's model has three databases, each a data source (aoa.demo.model.data_sources) that several of its resources name as their type argument — class SupportStorage(BaseStorage[ShopDataSource]):

Data source Resources What it shows
ShopDataSource StorefrontDatabase (Store), SupportStorage (Support), InventoryStorage (Inventory) a support ticket relates to the order and the customer it is about — across resources and across domains, inside one database
MessagingDataSource OutboxPrimaryDatabase, MessagingDeadLetterStore (Messaging) a replay ticket in the dead-letter queue relates to the outbox message it replays
CatalogDataSource CatalogObjectStore (Catalog) a database with one resource

Every other resource names no data source and keeps its relations to itself; a relation across two databases is refused when the model is built. The graph shows each data source on the application, with a resource_data_source edge from each of its resources. The identity route's IdentityDataSource is the runtime pool of the section above; its resource imports the PostgreSQL driver and is reached lazily, so it is not in the graph.

Its graph history

The demo keeps its graph in graph.json, rebuilt by graph-builder write with every change of its model, so the file's git history is the graph's history. Paste this link into Maxitor's AOA Service URL field to walk through it, compare any two versions, and see the open pull requests after the newest one:

https://github.com/bystrovmaxim/aoa/blob/main/packages/aoa-demo/graph.json?version_link=https%3A%2F%2Fgithub.com%2Fbystrovmaxim%2Faoa%2Fblob%2Fmain%2Fpackages%2Faoa-demo%2Fpyproject.toml&version_key=project.version

The version under each point comes from this package's pyproject.toml. How to read the track is in Open a service's graph history.

Metadata

Release files for aoa-demo 3.18.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aoa-demo 3.18.0
File Size Uploaded Provenance Actions
aoa_demo-3.18.0.tar.gz 139.1 kB Without provenance Details for aoa_demo-3.18.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aoa-demo 3.18.0
File Interpreter ABI Platform Actions
aoa_demo-3.18.0-py3-none-any.whl Python 3 none any Details for aoa_demo-3.18.0-py3-none-any.whl

Total release size: 524.5 kB

Release files / aoa_demo-3.18.0.tar.gz

Download URL aoa_demo-3.18.0.tar.gz
Size 139.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5d8a52e06258126e05b0fe75b7c189ce97bfd833948a664eef6e5f977b04e42b
BLAKE2b-256 checksum
How to use checksums
db28bec4df7d941260a11edbc81d95a3d0afc0ce2af793178401a5bf895aee61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / aoa_demo-3.18.0-py3-none-any.whl

Download URL aoa_demo-3.18.0-py3-none-any.whl
Size 385.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87437922c4d3e5fb469ca817f4b244c0ce1538154bf8f5ccc0de412302c9006f
BLAKE2b-256 checksum
How to use checksums
778e7dccc489dcb8f202e04534204ea21d5b52ff57356f63999185a31e751134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for aoa-demo 3.18.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page