Package app.ductape.sdk.agents
Class AgentsService
java.lang.Object
app.ductape.sdk.agents.AgentsService
TS parity: sdk/ts/src/agents/agents.service.ts (define/register/dispatch/local registry).
run() mirrors TS's createLLMProvider(resolvedModelConfig): it resolves the
agent's configured model (via ModelService.fetch(java.util.Map<java.lang.String, java.lang.Object>)) to read provider/model/
the env-specific (encrypted) apiKey, decrypts the key with the product's private key
(same algorithm ModelService uses to encrypt it), and builds a matching
AnthropicLlmProvider/OpenAiLlmProvider for the call — exactly like TS's
agent-executor.ts#createLLMProvider switch on config.provider. This only applies
when the still-default DefaultAgentExecutor (auto-wired by the constructor with an
echo/stub provider) is in place; an explicitly registered custom executor always takes priority, matching the existing override seam.
-
Constructor Summary
ConstructorsConstructorDescriptionAgentsService(EnvType env, RequestContext auth) AgentsService(EnvType env, RequestContext auth, JobsService jobsService) AgentsService(RequestContext auth, ProductsService productsService, JobsService jobsService) -
Method Summary
Modifier and TypeMethodDescriptionauth()voidclearAll()voidcreateAgent(String productId, Map<String, Object> agentPayload) TSdefine: validates core fields, registers tools, optionally persists viacreateAgent.voiddeleteAgent(String productId, String tag) voiddeleteAgentLocal(String tag) TSdispatch: enqueue processor job typeaction, eventagent:{agent}.fetchAgent(String productId, String tag) fetchAgents(String productId) booleanWhether anAgentLocalExecutoris registered.TSlist: lists currently-active executions, optionally filtered by agent tag and/or status, paginated the same way TS does (1-based page, default limit 10).voidTSregister(product, agent): persist agent configuration and refresh local cache.voidregisterLocal(String tag, Map<String, Object> registration) Back-compat alias for simple local-only registration.TSrun: routes through the registeredAgentLocalExecutorwhen available; otherwise raises an explicit configuration error guiding callers todispatch(Map)or to wire a custom executor.voidsetLocalExecutor(AgentLocalExecutor executor) Register an in-processAgentLocalExecutor(TSAgentExecutorparity seam), overriding the auto-wired default (echo-provider) executor.TSstatus: looks up an in-flight execution by id.voidupdateAgent(String productId, Map<String, Object> agentPayload)
-
Constructor Details
-
AgentsService
-
AgentsService
-
AgentsService
-
-
Method Details
-
auth
-
define
TSdefine: validates core fields, registers tools, optionally persists viacreateAgent. -
register
TSregister(product, agent): persist agent configuration and refresh local cache. -
registerLocal
Back-compat alias for simple local-only registration. -
getAgent
-
listAgents
-
deleteAgentLocal
-
clearAll
public void clearAll() -
tools
-
setLocalExecutor
Register an in-processAgentLocalExecutor(TSAgentExecutorparity seam), overriding the auto-wired default (echo-provider) executor. Once called,run(Map)always delegates to this executor as-is and no longer attempts the per-call model-to-LLM-provider resolution described on the class. -
hasLocalExecutor
public boolean hasLocalExecutor()Whether anAgentLocalExecutoris registered. Useful for callers that want to gate behavior at runtime without try/catching the configuration error fromrun(Map). -
run
TSrun: routes through the registeredAgentLocalExecutorwhen available; otherwise raises an explicit configuration error guiding callers todispatch(Map)or to wire a custom executor. -
status
TSstatus: looks up an in-flight execution by id. Mirrors TS's own limitation — oncerun()returns, the execution is removed from the active map (same as TS deleting fromactiveExecutorsright afterexecute()), so this only finds executions that are genuinely still running concurrently with the status() call. -
list
TSlist: lists currently-active executions, optionally filtered by agent tag and/or status, paginated the same way TS does (1-based page, default limit 10). -
dispatch
TSdispatch: enqueue processor job typeaction, eventagent:{agent}. -
createAgent
-
updateAgent
-
fetchAgent
-
fetchAgents
-
deleteAgent
-