This is a read-only mirror of the HSC engineering wiki, restored from a 2017 archive. Some links are broken and some content is out of date. About this mirror.
Task Graph Format
From ANTFARM Wiki
This is an old revision of this page, as archived. The mirror serves the archived text for every revision id.
| Task Graph Format | |
|---|---|
| Extension | .tg |
| Compiler | antc |
| Status | current |
| Archive ref | QUANTARA-SWARMGLASS-R55-94B3B1 |
Contents[hide] |
A task graph is a text file describing a DAG of tool calls. antc (Legacy Toolchain) compiles it into a bundle the queen can assign node by node.
[edit] Syntax
graph <name> {
<node> = <tool>(<arg>: <expr>, ...)
...
}
<tool>must exist in the manifest at compile time.<expr>is a literal ("string",42,true) or a reference<node>.<output>.- References define edges. A node runs when every referenced node has a result.
- Nodes without references are roots and are assigned immediately.
[edit] Example
graph crawl-index {
seed = fetch.http(url: "http://wiki.hm.internal/wiki/Special:AllPages")
pages = convert.doc2text(input: seed.body)
idx = index.write(key: "cm://index/latest", value: pages.text)
sum = model.summarize(input: pages.text, max_tokens: 200)
note = index.write(key: "cm://index/latest/summary", value: sum.text)
}
sum and idx both depend only on pages and run in parallel on two foragers. note waits for sum.
[edit] Attributes
Attributes go in square brackets after the node name:
sum [deadline: 600, retries: 2, cost: model] = model.summarize(...)
| Attribute | Meaning |
|---|---|
deadline | seconds after assignment; past it the queen reissues (see AF-80 for what happens when it is already past) |
retries | reject/failure retries before the graph fails |
cost | override the manifest cost class |
pin | forager name; forces assignment |
[edit] Cycles
Cycles are invalid. antc check catches them except through model.* nodes in 1.4 (AF-83). If a graph hangs with no progress, this is the first thing to check.
[edit] Grammar history
- v1 (2010): no attributes,
->edge syntax. Rejected by 1.2+. - v2 (2011): reference syntax, attributes.
- v3 (2012): string escapes,
pin. Current.