Class AiGraphAgentSpringLauncher

java.lang.Object
com.aispect.engine.spring.launcher.AiGraphAgentSpringLauncher
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

public class AiGraphAgentSpringLauncher extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Spring environment Graph Agent Initiators and route distributors.

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

    Constructors
    Constructor
    Description
    Constructor, given by Spring Automatically inject dependencies AiOperations。
  • Method Summary

    Modifier and Type
    Method
    Description
    executeAgent(String agentName, String initialTopic)
    Trigger designation Graph Agent execution process. Users can Controller or RouterFunction Receive in HTTP request and then call this method.
    void
    onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
    monitor Spring The container refreshes the completed event and performs scanning and initialization work.
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    accomplish ApplicationContextAware,Get the current Spring Application context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution
  • Constructor Details

    • AiGraphAgentSpringLauncher

      public AiGraphAgentSpringLauncher(AiOperations aiOperations)
      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
      accomplish ApplicationContextAware,Get the current Spring Application context.
      Specified by:
      setApplicationContext in interface org.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:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
      Parameters:
      event - Context refresh event.
    • executeAgent

      public Object executeAgent(String agentName, String initialTopic) throws Exception
      Trigger designation Graph Agent execution process. Users can Controller or RouterFunction Receive in HTTP request and then call this method.
      Parameters:
      agentName - Target Agent name
      initialTopic - initial input context
      Returns:
      Execution result
      Throws:
      Exception - when Agent Does not exist or is thrown when an exception is executed.