/\ 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.

Tool discovery

Directory examples/python/tool_discovery

Discover registered skills, select allowed tools and bound a model's tool loop. Prepare the SDK and CLI from the repository root:

Agent node label utility-worker, version 1.0.0.

Capabilities

CapabilityKindSignatureModuleSummary
ask_with_toolstraversal(question: str) -> dictexamples/python/tool_discovery/agent.py
guarded_querytraversal(question: str) -> dictexamples/python/tool_discovery/agent.py
inspect_toolstraversal(query: str = '') -> dictexamples/python/tool_discovery/agent.py
smart_querytraversal(question: str) -> dictexamples/python/tool_discovery/agent.pyTwo-stage selection: ask for tool names first, then supply selected schemas.
weather_reporttraversal(cities: str) -> dictexamples/python/tool_discovery/agent.py
calculateskill(operation: str, a: float, b: float) -> dictexamples/python/tool_discovery/worker.pyAdd, subtract, multiply or divide two numbers.
get_weatherskill(city: str) -> dictexamples/python/tool_discovery/worker.pyWeather fixture for a city; never a live forecast.
summarizetraversal(text: str) -> dictexamples/python/tool_discovery/worker.py

Commands

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

atfg server start
atfg traverse orchestrator.ask_with_tools --in '{"question":"Use the calculator to add 2 and 3."}'
atfg traverse orchestrator.guarded_query --in '{"question":"Divide 20 by 4."}'
atfg traverse orchestrator.smart_query --in '{"question":"Multiply 42 by 17."}'
atfg traverse orchestrator.weather_report --in '{"cities":"Tokyo and Sydney"}'
atfg traverse utility-worker.calculate --in '{"operation":"add","a":2,"b":3}'
atfg traverse utility-worker.summarize --in '{"text":"Our itinerary has three days in Bali and a beach afternoon."}'
cargo build --bin atfgraphd --bin atfg
python -m atfgraph.worker --module examples.python.tool_discovery.agent:app
python -m atfgraph.worker --module examples.python.tool_discovery.worker:app
python -m examples.python.tool_discovery.call inspect_tools '{}'
python -m pip install -e ./python

Files

  • examples/python/tool_discovery/README.md
  • examples/python/tool_discovery/__init__.py
  • examples/python/tool_discovery/agent.py
  • examples/python/tool_discovery/agentnode.yaml
  • examples/python/tool_discovery/call.py
  • examples/python/tool_discovery/requirements.txt
  • examples/python/tool_discovery/worker.agentnode.yaml
  • examples/python/tool_discovery/worker.py

README

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

Discover registered skills, select allowed tools and bound a model's tool loop. 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

Use the local server at http://127.0.0.1:18880 and /ui/, or set the URL/key for another server.

Run the utility node and orchestrator in separate terminals:

python -m atfgraph.worker --module examples.python.tool_discovery.worker:app
python -m atfgraph.worker --module examples.python.tool_discovery.agent:app
atfg traverse utility-worker.calculate --in '{"operation":"add","a":2,"b":3}'
python -m examples.python.tool_discovery.call inspect_tools '{}'

The direct calls need no provider credentials. Weather is labeled fixture data; invalid calculator operations and division by zero fail explicitly.

For model-backed handlers, configure the worker's ATFGRAPH_MODEL_URL, ATFGRAPH_MODEL_NAME and required API key before startup:

atfg traverse orchestrator.ask_with_tools --in '{"question":"Use the calculator to add 2 and 3."}'
atfg traverse orchestrator.weather_report --in '{"cities":"Tokyo and Sydney"}'
atfg traverse orchestrator.smart_query --in '{"question":"Multiply 42 by 17."}'
atfg traverse orchestrator.guarded_query --in '{"question":"Divide 20 by 4."}'
atfg traverse utility-worker.summarize --in '{"text":"Our itinerary has three days in Bali and a beach afternoon."}'

Discovery is limited to utility-worker skills. Weather selection matches name/description. smart_query asks the model to choose target names, validates them against an allowlist, then supplies the selected schemas. Schema discovery itself remains eager. guarded_query limits execution to three rounds and five calls. Each tool execution becomes a child traversal. Model requests can incur charges and fail without provider configuration.

ATFGraph documentationHosted workflow · Framework reference