Tune tracker workers and bound agent budgets

The tracker-mapping and common-pattern-enrichment workers ran with the
kit/worker defaults (interval 10s, max-concurrency 5 each) and dropped
the resolved per-agent max-tokens/temperature, so up to ten LLM
pipelines could run unbounded on one OpenAI client. The mapping worker
also held a FOR UPDATE transaction across the LLM and Firecrawl calls
while its DB search tools acquired a second pooled connection, risking
pool exhaustion under concurrency.

Plumb max-tokens, temperature, agent timeout, and per-worker max-turns
through TrackerAgentsConfig and DisambiguationConfig into all three
agent builders, replacing the hard-coded constants with config-fed
fields and package fallbacks. Expose worker interval, concurrency,
stale-after, agent timeout, and max-turns as config (env, Helm values,
deployment template) mirroring the evidence-describer pattern, and
apply them at registration.

Refactor Process into deterministic-read, agent (no transaction), and
persist phases so neither the mapping agent nor disambiguation runs
inside an open transaction, removing the row locks held across network
latency and the nested-connection pressure.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-29 16:37:32 +02:00
parent 50c5454681
commit 55302d18f0
17 changed files with 818 additions and 339 deletions

View File

@@ -264,6 +264,44 @@ spec:
- name: AGENT_TRACKER_MAPPING_MAX_TOKENS
value: {{ .Values.probo.trackerMapping.maxTokens | quote }}
{{- end }}
# Tracker Mapping Worker
{{- if .Values.probo.trackerMappingWorker.interval }}
- name: TRACKER_MAPPING_INTERVAL
value: {{ .Values.probo.trackerMappingWorker.interval | quote }}
{{- end }}
{{- if .Values.probo.trackerMappingWorker.maxConcurrency }}
- name: TRACKER_MAPPING_MAX_CONCURRENCY
value: {{ .Values.probo.trackerMappingWorker.maxConcurrency | quote }}
{{- end }}
{{- if .Values.probo.trackerMappingWorker.agentTimeout }}
- name: TRACKER_MAPPING_AGENT_TIMEOUT
value: {{ .Values.probo.trackerMappingWorker.agentTimeout | quote }}
{{- end }}
{{- if .Values.probo.trackerMappingWorker.agentMaxTurns }}
- name: TRACKER_MAPPING_AGENT_MAX_TURNS
value: {{ .Values.probo.trackerMappingWorker.agentMaxTurns | quote }}
{{- end }}
# Common Pattern Enrichment Worker
{{- if .Values.probo.commonPatternEnrichmentWorker.interval }}
- name: COMMON_PATTERN_ENRICHMENT_INTERVAL
value: {{ .Values.probo.commonPatternEnrichmentWorker.interval | quote }}
{{- end }}
{{- if .Values.probo.commonPatternEnrichmentWorker.maxConcurrency }}
- name: COMMON_PATTERN_ENRICHMENT_MAX_CONCURRENCY
value: {{ .Values.probo.commonPatternEnrichmentWorker.maxConcurrency | quote }}
{{- end }}
{{- if .Values.probo.commonPatternEnrichmentWorker.staleAfter }}
- name: COMMON_PATTERN_ENRICHMENT_STALE_AFTER
value: {{ .Values.probo.commonPatternEnrichmentWorker.staleAfter | quote }}
{{- end }}
{{- if .Values.probo.commonPatternEnrichmentWorker.agentTimeout }}
- name: COMMON_PATTERN_ENRICHMENT_AGENT_TIMEOUT
value: {{ .Values.probo.commonPatternEnrichmentWorker.agentTimeout | quote }}
{{- end }}
{{- if .Values.probo.commonPatternEnrichmentWorker.agentMaxTurns }}
- name: COMMON_PATTERN_ENRICHMENT_AGENT_MAX_TURNS
value: {{ .Values.probo.commonPatternEnrichmentWorker.agentMaxTurns | quote }}
{{- end }}
# Custom Domains
{{- if .Values.probo.customDomains.enabled }}
- name: CUSTOM_DOMAINS_RENEWAL_INTERVAL

View File

@@ -176,6 +176,23 @@ probo:
# temperature: "0.1"
# maxTokens: "1024"
# Tracker mapping worker tuning (optional; seconds for interval/agentTimeout).
# Keep concurrency modest to stay under OpenAI/Firecrawl limits and the DB pool.
# trackerMappingWorker:
# interval: 10
# maxConcurrency: 3
# agentTimeout: 45
# agentMaxTurns: 4
# Common-pattern enrichment worker tuning (optional; seconds for
# interval/staleAfter/agentTimeout).
# commonPatternEnrichmentWorker:
# interval: 10
# maxConcurrency: 2
# staleAfter: 600
# agentTimeout: 45
# agentMaxTurns: 3
# OpenTelemetry tracing (optional)
tracing:
enabled: true

View File

@@ -276,6 +276,24 @@ probo:
temperature: ""
maxTokens: ""
# Tracker mapping background worker tuning (optional). interval and
# agentTimeout are in seconds. Keep concurrency modest to stay under
# OpenAI/Firecrawl rate limits and the database connection pool.
trackerMappingWorker:
interval: 10
maxConcurrency: 3
agentTimeout: 45
agentMaxTurns: 4
# Common-pattern enrichment background worker tuning (optional).
# interval, staleAfter, and agentTimeout are in seconds.
commonPatternEnrichmentWorker:
interval: 10
maxConcurrency: 2
staleAfter: 600
agentTimeout: 45
agentMaxTurns: 3
# Custom domains configuration (optional)
customDomains:
enabled: false