Files
probo/pkg/probod/third_party_assessor.go
Émile Ré 2040931405 Move Firecrawl API key from top-level config into Agents.Tools
Firecrawl is a tool used by agents (tracker mapping, third-party
assessor), so its configuration belongs under AgentsConfig rather than
as a standalone Config field. Adds AgentToolsConfig to hold agent tool
credentials and updates all config propagation consumers.

Signed-off-by: Émile Ré <emile@probo.com>
2026-05-19 12:32:41 +04:00

59 lines
2.2 KiB
Go

// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package probod
import (
"github.com/prometheus/client_golang/prometheus"
"go.gearno.de/kit/log"
"go.opentelemetry.io/otel/trace"
"go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/vetting"
)
// buildThirdPartyAssessor wires the thirdParty assessment agent. It is an opt-in
// feature: deployments that do not set `llm.third-party-assessor.provider` get a
// DisabledThirdPartyAssessor that reports the feature as unavailable. The
// third-party-assessor does not inherit the default provider because its
// pipeline (LLM + browser + search) is expensive and should not be enabled
// implicitly.
func (impl *Implm) buildThirdPartyAssessor(
l *log.Logger,
tp trace.TracerProvider,
r prometheus.Registerer,
) (probo.ThirdPartyAssessor, error) {
if impl.cfg.Agents.ThirdPartyAssessor.Provider == "" {
return probo.DisabledThirdPartyAssessor{}, nil
}
agentCfg, llmClient, err := impl.resolveAgentClient("third-party-assessor", impl.cfg.Agents.ThirdPartyAssessor, l, tp, r)
if err != nil {
return nil, err
}
maxTokens := vetting.DefaultMaxTokens
if agentCfg.MaxTokens != nil {
maxTokens = *agentCfg.MaxTokens
}
return vetting.NewAssessor(vetting.Config{
Client: llmClient,
Model: agentCfg.ModelName,
MaxTokens: maxTokens,
ChromeAddr: impl.cfg.ChromeDPAddr,
FirecrawlAPIKey: impl.cfg.Agents.Tools.FirecrawlAPIKey,
Logger: l.Named("third-party-assessor"),
}), nil
}