feat(statestore): record a usage row for every model call
Task agent runs and MCP sampling record against their task (billed to the task's org); gateway chat turns, titles, sampling and curators record against the system org. Rows carry source, workflow, step, alias, provider/model and tokens for later chargeback.
This commit is contained in:
1 parent
12b9a57404
commit
e4ea2eaabc
31 files changed
+1068
-322
No files matched your search
@@ -233,7 +233,7 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
if len(req.MCPServers) > 0 {
|
||||
llm = modelloop.NewRuntime(req.Providers, req.Cfg.ModelLimits)
|
||||
}
|
||||
mcpSet, mcpErr := startMCPProviders(ctx, req.MCPServers, taskSamplingHandler(llm, req.Cfg), log)
|
||||
mcpSet, mcpErr := startMCPProviders(ctx, req.MCPServers, taskSamplingHandler(llm, req.Cfg, samplingUsageRecorder(dependencies.store, req.Task, log)), log)
|
||||
if mcpSet != nil {
|
||||
defer mcpSet.cleanup(ctx, log)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user