Container worker & logs
This example runs the same outbound worker directly or in Docker, then shows where its logs appear. From the repository root, prepare the SDK and CLI:
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
demo_echo | traversal | (message: str = 'Hello!') -> dict | examples/python/container_node/agent.py | |
hello | traversal | (name: str = 'ATFGraph') -> dict | examples/python/container_node/agent.py |
Commands
atfg server start
atfg traverse container-node.demo_echo --in '{"message":"container check"}'
cargo build --bin atfgraphd --bin atfg
docker compose -f examples/python/container_node/compose.yaml down
docker compose -f examples/python/container_node/compose.yaml logs -f
docker compose -f examples/python/container_node/compose.yaml up --build
python -m examples.python.container_node.agent
python -m examples.python.container_node.call hello '{"name":"Ada"}'
python -m pip install -e ./python
Files
examples/python/container_node/Dockerfileexamples/python/container_node/README.mdexamples/python/container_node/__init__.pyexamples/python/container_node/agent.pyexamples/python/container_node/agentnode.yamlexamples/python/container_node/call.pyexamples/python/container_node/compose.yamlexamples/python/container_node/requirements.txt
README
This example runs the same outbound worker directly or in Docker, then shows where its logs appear. From the repository root, prepare the SDK and CLI:
python -m pip install -e ./python
cargo build --bin atfgraphd --bin atfg
export PATH="$PWD/target/debug:$PATH"
atfg server start
Use the default server at http://127.0.0.1:18880 and Console at /ui/, or set ATFGRAPH_SERVER and the required ATFGRAPH_API_KEY for your server.
python -m examples.python.container_node.agent
# Another terminal:
atfg traverse container-node.demo_echo --in '{"message":"container check"}'
python -m examples.python.container_node.call hello '{"name":"Ada"}'
To move the worker into Docker:
docker compose -f examples/python/container_node/compose.yaml up --build
# Inspect both stdout and stderr heartbeats:
docker compose -f examples/python/container_node/compose.yaml logs -f
# Stop only this example:
docker compose -f examples/python/container_node/compose.yaml down
No callback port is needed. Set ATFGRAPH_CONTAINER_SERVER to an address reachable from the container. A host listener bound only to loopback may need a reachable interface or shared Docker network. These commands do not change the server's listener.
Process stdout/stderr stays in container logs. To also store structured traversal logs on the graph server, an administrator enables node_logs_enabled, then the worker starts with ATFGRAPH_DEMO_SHIP_LOGS=1. For example:
import asyncio
from atfgraph import Agent
async def configure():
app = Agent(node_id="log-settings")
try:
await app.observability.set_settings(node_logs_enabled=True)
finally:
await app.client.aclose()
asyncio.run(configure())
The logging handler ships records emitted inside traversals, not every process output line. This example needs no model credentials.