AutonomousAgent / agent /query_grid.py
Mathias Heider
More papers: budget-aware sources, frontier rotation, schema gate, topic walk, S2 bulk, datasheets, query grid
b108542 unverified
Raw History Blame Contribute Delete
5.03 kB
"""Deterministic query frontier for the agent: materials × reinforcement ×
property/process, curated rather than a full cross product.
Why: the Sep 8 2026 funnel showed cycles that re-ran already-used queries
downloading 0.7 % of their fresh candidates vs 13 % for cycles on new
queries. Eight builtin intents plus Gemini's ~5 expansions per dry cycle
kept the frontier tiny; this module gives it a few hundred distinct,
domain-specific intents up front. Seeded once at boot (idempotent —
agent_queries.query is UNIQUE) with origin='grid', so the LRU rotation
(`last_used_at NULLS FIRST`) works through them before revisiting anything.
Keep it deterministic: `build()` must return the same list on every boot so
the seed is a no-op after the first one.
"""
from __future__ import annotations
# Matrix polymers as they appear in titles/abstracts. Each entry: (search
# token, human phrase) — the phrase is what goes into the query.
MATRICES = [
("PEEK", "PEEK"),
("PEKK", "PEKK"),
("PAEK", "polyaryletherketone"),
("PPS", "PPS polyphenylene sulfide"),
("PEI", "PEI polyetherimide"),
("PA6", "polyamide 6"),
("PA66", "polyamide 66"),
("PA12", "polyamide 12"),
("PP", "polypropylene"),
("PC", "polycarbonate"),
("PET", "PET polyester"),
("TPU", "thermoplastic polyurethane"),
("LCP", "liquid crystal polymer"),
("PPA", "polyphthalamide"),
("PSU", "polysulfone"),
("PLA", "polylactic acid"),
]
REINFORCEMENTS = [
"carbon fiber", "glass fiber", "aramid fiber", "basalt fiber",
"natural fiber", "flax fiber", "short fiber", "long fiber",
"continuous fiber", "woven fabric", "unidirectional tape",
]
# Properties and processes that carry the numbers the database stores.
PROPERTIES = [
"tensile properties", "flexural properties", "impact strength",
"fatigue behavior", "creep behavior", "interlaminar shear strength",
"fracture toughness", "compressive strength", "thermal conductivity",
"glass transition crystallinity", "coefficient of thermal expansion",
"void content mechanical properties", "moisture absorption properties",
"fiber matrix interface", "dielectric properties",
]
PROCESSES = [
"automated fiber placement", "in-situ consolidation", "thermoforming",
"compression molding", "injection molding", "overmolding",
"induction welding", "ultrasonic welding", "resistance welding",
"fused filament fabrication", "additive manufacturing",
"organosheet", "prepreg consolidation", "recycling mechanical properties",
"annealing crystallinity",
]
# Matrix families that dominate the composites literature get the full
# property list; the rest get a compact core so the grid stays a few hundred
# intents rather than thousands of near-duplicates.
CORE_MATRICES = {"PEEK", "PEKK", "PPS", "PEI", "PA6", "PA66", "PP", "PA12"}
CORE_REINFORCEMENTS = ["carbon fiber", "glass fiber"]
CORE_PROPERTIES = ["tensile properties", "flexural properties", "fatigue behavior",
"interlaminar shear strength", "thermal conductivity",
"glass transition crystallinity"]
CORE_PROCESSES = ["automated fiber placement", "thermoforming", "injection molding",
"induction welding", "fused filament fabrication"]
GENERIC = (
[f"thermoplastic composite {p}" for p in PROPERTIES]
+ [f"thermoplastic composite {p}" for p in PROCESSES]
+ [f"carbon fiber reinforced thermoplastic {p}" for p in PROPERTIES]
+ [f"glass fiber reinforced thermoplastic {p}" for p in PROPERTIES]
+ [f"{r} reinforced thermoplastic composite properties" for r in REINFORCEMENTS]
+ [
"thermoplastic composite datasheet mechanical properties",
"thermoplastic prepreg tape mechanical properties",
"long fiber thermoplastic LFT mechanical properties",
"glass mat thermoplastic GMT mechanical properties",
"hybrid thermoplastic composite laminate properties",
"thermoplastic composite sandwich panel properties",
"recycled carbon fiber thermoplastic composite properties",
"self-reinforced polypropylene composite properties",
]
)
def build() -> list[str]:
"""The grid, deterministic and de-duplicated, ~250 intents."""
out: list[str] = []
def add(q: str) -> None:
q = " ".join(q.split())
if q and q not in out:
out.append(q)
for g in GENERIC:
add(g)
for tok, phrase in MATRICES:
core = tok in CORE_MATRICES
reinfs = REINFORCEMENTS[:4] if core else CORE_REINFORCEMENTS
props = PROPERTIES if core else CORE_PROPERTIES
procs = PROCESSES if core else CORE_PROCESSES
for r in reinfs:
add(f"{r} {phrase} composite mechanical properties")
for p in props:
add(f"{phrase} composite {p}")
for pr in procs:
add(f"{phrase} composite {pr}")
return out
if __name__ == "__main__":
qs = build()
print(len(qs), "queries")
for q in qs:
print(q)