Tool discovery
Discover registered skills, select allowed tools and bound a model's tool loop. Prepare the SDK and CLI from the repository root:
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
ask_with_tools | traversal | (question: str) -> dict | examples/python/tool_discovery/agent.py | |
guarded_query | traversal | (question: str) -> dict | examples/python/tool_discovery/agent.py | |
inspect_tools | traversal | (query: str = '') -> dict | examples/python/tool_discovery/agent.py | |
smart_query | traversal | (question: str) -> dict | examples/python/tool_discovery/agent.py | Two-stage selection: ask for tool names first, then supply selected schemas. |
weather_report | traversal | (cities: str) -> dict | examples/python/tool_discovery/agent.py | |
calculate | skill | (operation: str, a: float, b: float) -> dict | examples/python/tool_discovery/worker.py | Add, subtract, multiply or divide two numbers. |
get_weather | skill | (city: str) -> dict | examples/python/tool_discovery/worker.py | Weather fixture for a city; never a live forecast. |
summarize | traversal | (text: str) -> dict | examples/python/tool_discovery/worker.py |
Commands
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.mdexamples/python/tool_discovery/__init__.pyexamples/python/tool_discovery/agent.pyexamples/python/tool_discovery/agentnode.yamlexamples/python/tool_discovery/call.pyexamples/python/tool_discovery/requirements.txtexamples/python/tool_discovery/worker.agentnode.yamlexamples/python/tool_discovery/worker.py
README
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.