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

Document search

Directory examples/python/document_search

Answer a question over local documents by planning subquestions, retrieving in parallel, then validating claim citations and exact quotes. Documents and vectors are temporary, scoped to the run and removed afterward.

Agent node label document_search, version 1.0.0.

Capabilities

CapabilityKindSignatureModuleSummary
plan_querytraversal(question: str) -> dictexamples/python/document_search/main.py
query_documenttraversal(file_path: str, question: str) -> dictexamples/python/document_search/main.py
retrieveskill(question: str, top_k: int = 4) -> list[dict]examples/python/document_search/main.py

Commands

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

EXAMPLE_MODE=fixture python -m atfgraph.worker --module examples.python.document_search.main:app
atfg install ./examples/python/document_search
atfg run document_search
atfg server start
atfg traverse document_search.query_document --in '{"file_path": "sample_document.txt", "question": "Summarize the document and cite the evidence."}'
python -m examples.python.document_search.call

Files

  • examples/python/document_search/README.md
  • examples/python/document_search/__init__.py
  • examples/python/document_search/agentnode.yaml
  • examples/python/document_search/call.py
  • examples/python/document_search/main.py
  • examples/python/document_search/node.py
  • examples/python/document_search/requirements.txt
  • examples/python/document_search/sample_document.txt
  • examples/python/document_search/support.py

README

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

Answer a question over local documents by planning subquestions, retrieving in parallel, then validating claim citations and exact quotes. Documents and vectors are temporary, scoped to the run and removed afterward.

Run locally

With the SDK installed, run from the repository root:

atfg server start
EXAMPLE_MODE=fixture python -m atfgraph.worker --module examples.python.document_search.main:app
# In a second terminal:
python -m examples.python.document_search.call

Or install the example as a managed local node:

atfg install ./examples/python/document_search
atfg run document_search

The node.py entrypoint also works after copying the folder outside the repository. The default server is http://127.0.0.1:18880; use /ui/ to inspect child calls and results.

Call with the CLI

atfg traverse document_search.query_document --in '{"file_path": "sample_document.txt", "question": "Summarize the document and cite the evidence."}'

Providers

Fixture mode is the default. It uses deterministic data and token-hash embeddings without external provider calls. Scores illustrate the flow rather than model quality.

To use real providers, set EXAMPLE_MODE=live and configure the model URL/name/key plus the full embedding endpoint URL, model and optional key through ATFGRAPH_MODEL_* and ATFGRAPH_EMBEDDING_*. Start the worker after setting them. Configuration failures do not fall back to fixture answers.

EXAMPLE_DOCUMENT_ROOT bounds local reads and defaults to this folder. Accepted files are text, Markdown and reStructuredText, at most 1 MB each and 100 files per folder ingestion. Treat document text as untrusted input. Valid citation IDs and exact quotes do not establish that a generated conclusion is correct.

Python client

from atfgraph import Client

async with Client("http://127.0.0.1:18880") as client:
    result = await client.traverse(
        "document_search.query_document",
        {'file_path': 'sample_document.txt', 'question': 'Summarize the document and cite the evidence.'},
        timeout=300,
    )
    print(result)
ATFGraph documentationHosted workflow · Framework reference