Class AiGraphAgentSpringLauncher
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
This component is in Spring The framework plays the following core roles:
1. Agent automatic registration: listening Spring Container refresh events, automatically scan and register all marked AiGraphAgent annotated Bean。
2. Status check: Check whether the classpath contains AiGraphAgent Annotated but not registered as Spring Bean class, thereby throwing warnings in advance during the development stage to prevent developers from missing @Service or @Component annotation.
3. Core Execution: Provide executeAgent method, leaving it to the user to decide on the business side how to pass HTTP (like RouterFunction or Controller)、Workflows are triggered through message queues and other channels.
4. Resource scheduling: parse the incoming parameters when triggered, build AI execution context (AiInvocationContext),and pass the corresponding Agent Orchestrator Instance scheduling execution Graph Workflow.
-
Constructor Summary
ConstructorsConstructorDescriptionAiGraphAgentSpringLauncher(AiOperations aiOperations) Constructor, given by Spring Automatically inject dependencies AiOperations。 -
Method Summary
Modifier and TypeMethodDescriptionexecuteAgent(String agentName, String initialTopic) Trigger designation Graph Agent execution process. Users can Controller or RouterFunction Receive in HTTP request and then call this method.voidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) monitor Spring The container refreshes the completed event and performs scanning and initialization work.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) accomplishApplicationContextAware,Get the current Spring Application context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
AiGraphAgentSpringLauncher
Constructor, given by Spring Automatically inject dependencies AiOperations。- Parameters:
aiOperations- implement AI The client interface implementation called.
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException accomplishApplicationContextAware,Get the current Spring Application context.- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
applicationContext- The injected context object.- Throws:
org.springframework.beans.BeansException- Thrown when the context configuration exception occurs.
-
onApplicationEvent
public void onApplicationEvent(@NonNull org.springframework.context.event.ContextRefreshedEvent event) monitor Spring The container refreshes the completed event and performs scanning and initialization work.- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>- Parameters:
event- Context refresh event.
-
executeAgent
Trigger designation Graph Agent execution process. Users can Controller or RouterFunction Receive in HTTP request and then call this method.- Parameters:
agentName- Target Agent nameinitialTopic- initial input context- Returns:
- Execution result
- Throws:
Exception- when Agent Does not exist or is thrown when an exception is executed.
-