On-demand node
Run a node for a bounded invocation instead of keeping its worker alive permanently. Prepare the SDK and CLI from the repository root:
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
hello | traversal | (name: str = 'ATFGraph') -> dict | examples/python/on_demand_node/agent.py | |
ping_child | traversal | (target: str, message: str) -> dict | examples/python/on_demand_node/agent.py |
Commands
atfg server start
atfg traverse on-demand-node.hello --in '{"name":"Ada"}'
cargo build --bin atfgraphd --bin atfg
python -m atfgraph.worker --module examples.python.on_demand_node.agent:app
python -m examples.python.on_demand_node.call --discover
python -m examples.python.on_demand_node.call hello '{"name":"Ada"}'
python -m examples.python.on_demand_node.call ping_child '{"target":"on-demand-node.hello","message":"Ada"}'
python -m pip install -e ./python
Files
examples/python/on_demand_node/README.mdexamples/python/on_demand_node/__init__.pyexamples/python/on_demand_node/agent.pyexamples/python/on_demand_node/agentnode.yamlexamples/python/on_demand_node/call.pyexamples/python/on_demand_node/requirements.txt
README
Run a node for a bounded invocation instead of keeping its worker alive permanently. Prepare the SDK and CLI from the repository root:
python -m pip install -e ./python
cargo build --bin atfgraphd --bin atfg
export PATH="$PWD/target/debug:$PATH"
atfg server start
Connect to the default local server at http://127.0.0.1:18880, or configure another server and API key. Inspect recorded work in its /ui/ Console.
python -m examples.python.on_demand_node.call --discover
python -m examples.python.on_demand_node.call hello '{"name":"Ada"}'
python -m examples.python.on_demand_node.call ping_child '{"target":"on-demand-node.hello","message":"Ada"}'
Each invocation starts an outbound worker, submits and claims a real traversal, and returns the server's result/path. ping_child adds a child call, which can target another registered node if that node has a serving worker. No inbound execution callback is required.
A function runtime can call agent.handler(event, context) with an invoke event containing capability and input. It also accepts discover, serve for queued work, and drain. Configure server credentials and network egress in the runtime. These local examples do not provision cloud functions or their provider-specific triggers.
For comparison, run the same node as a normal long-running worker:
python -m atfgraph.worker --module examples.python.on_demand_node.agent:app
atfg traverse on-demand-node.hello --in '{"name":"Ada"}'