Offline mesh
Host concierge and fares in one process with atfgraph.offline.OfflineMesh. It executes nested calls without a graph server. The offline-mesh test suite checks this local mode; it has different persistence and API coverage from the shared server.
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
plan | traversal | (origin: str, cities: List[str], nights: int = 2) -> dict | examples/python/features/offline_mesh/agent.py | Quote each leg through the fares node, keep the itinerary in session memory, return the cost tree. |
quote | skill | (origin: str, destination: str, nights: int = 1) -> dict | examples/python/features/offline_mesh/agent.py | Deterministic fixture fare; records usage as if a pricing model had been consulted. |
recall | traversal | () -> dict | examples/python/features/offline_mesh/agent.py | Read the itinerary the session remembered (empty outside a session that planned one). |
Commands
python -m atfgraph.worker --module examples.python.features.offline_mesh.agent:concierge
python -m atfgraph.worker --module examples.python.features.offline_mesh.agent:fares
python -m examples.python.features.offline_mesh.run
python -m examples.python.features.offline_mesh.run --serve 127.0.0.1:8765 # optional uvicorn
python -m examples.python.features.offline_mesh.run --serve 127.0.0.1:8765 # needs the optional uvicorn
Files
examples/python/features/offline_mesh/README.mdexamples/python/features/offline_mesh/__init__.pyexamples/python/features/offline_mesh/agent.pyexamples/python/features/offline_mesh/agentnode.yamlexamples/python/features/offline_mesh/run.py
README
Host concierge and fares in one process with atfgraph.offline.OfflineMesh. It executes nested calls without a graph server. The offline-mesh test suite checks this local mode; it has different persistence and API coverage from the shared server.
| Piece | What it shows |
|---|---|
OfflineMesh([concierge, fares]) | each node mounted as an ASGI sub-app at /{node_id} of one root ASGI app (/health, /nodes, /{node}/health, /{node}/definition, POST /{node}/capabilities/{name}) |
mesh.invoke("concierge.plan", ..., session_id="trip-1") | dispatch through the ASGI app; failures raise the usual TraversalFailed / TraversalCancelled / TraversalTimedOut |
await concierge.traverse("fares.quote", ...) inside the handler | a nested child executed in-process by the other node, with its own task-local ExecutionContext (parent step, inherited root and session, real local lease) |
fares.memory.set(...) / concierge.memory.get(...) | the mesh's in-memory store, scoped exactly as the SDK selects (session → workflow → global) |
record_usage + app.execution_cost() | per-execution tracker, usage progress events, offline usage store, child usage propagated into the parent |
mesh.discovery | the normal AgentMesh facade over the offline registry |
mesh.submit(...) → Handle | poll, cancel, path(), event_log(), events() through mesh.client() |
python -m examples.python.features.offline_mesh.run
python -m examples.python.features.offline_mesh.run --serve 127.0.0.1:8765 # optional uvicorn
curl -s -X POST localhost:8765/concierge/capabilities/plan -H 'x-atfgraph-session-id: t1' \
-d '{"origin":"BNE","cities":["SYD"]}'
You can also serve the same Agent definitions as normal outbound workers, for example through examples.python.features.offline_mesh.agent:concierge. Server mode provides the shared runtime rather than the local in-memory graph.
What offline means here
- Local execution never claims a remote lease. The offline graph issues and checks its own leases for nested calls, progress, usage and checkpoints; invalid leases return 409.
- Unsupported routes, including approvals, knowledge, vector search, publications and retention, return
501 offline_unsupported. Inspectmesh.graph.unsupportedto see which were attempted. - State exists only for the mesh lifetime and does not survive process loss.
- Fares are deterministic fixtures; no supplier or model is contacted.