/\ ATFGraph /docs
README Downloads
Examples / ATFGraph
Framework reference

This article is retained from the existing framework docs. Self-hosting commands and server-admin access differ from the managed CLI workflow. Start with Get started for the installed product.

Container worker & logs

Directory examples/python/container_node

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:

Agent node label container-node, version 1.0.0.

Capabilities

CapabilityKindSignatureModuleSummary
demo_echotraversal(message: str = 'Hello!') -> dictexamples/python/container_node/agent.py
hellotraversal(name: str = 'ATFGraph') -> dictexamples/python/container_node/agent.py

Commands

Taken from this example's own README and module docstrings.

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/Dockerfile
  • examples/python/container_node/README.md
  • examples/python/container_node/__init__.py
  • examples/python/container_node/agent.py
  • examples/python/container_node/agentnode.yaml
  • examples/python/container_node/call.py
  • examples/python/container_node/compose.yaml
  • examples/python/container_node/requirements.txt

README

Rendered from examples/python/container_node/README.md; the source file is not modified.

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.

ATFGraph documentationHosted workflow · Framework reference