Skip to content

AgentRouter

Sub classes

Name Children Inherits
CallbackRouter
llmling_agent.delegation.router
Router using callback function for decisions.
    RuleRouter
    llmling_agent.delegation.router
    Router using predefined rules.

      🛈 DocStrings

      Base class for routing messages between agents.

      Source code in src/llmling_agent/delegation/router.py
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      124
      125
      class AgentRouter:
          """Base class for routing messages between agents."""
      
          async def decide(self, message: Any) -> Decision:
              """Make routing decision for message."""
              raise NotImplementedError
      
          def get_wait_decision(
              self, target: str, reason: str, talk_back: bool = False
          ) -> Decision:
              """Create decision to route and wait for response."""
              return AwaitResponseDecision(
                  target_agent=target, reason=reason, talk_back=talk_back
              )
      
          def get_route_decision(self, target: str, reason: str) -> Decision:
              """Create decision to route without waiting."""
              return RouteDecision(target_agent=target, reason=reason)
      
          def get_end_decision(self, reason: str) -> Decision:
              """Create decision to end routing."""
              return EndDecision(reason=reason)
      

      decide async

      decide(message: Any) -> Decision
      

      Make routing decision for message.

      Source code in src/llmling_agent/delegation/router.py
      107
      108
      109
      async def decide(self, message: Any) -> Decision:
          """Make routing decision for message."""
          raise NotImplementedError
      

      get_end_decision

      get_end_decision(reason: str) -> Decision
      

      Create decision to end routing.

      Source code in src/llmling_agent/delegation/router.py
      123
      124
      125
      def get_end_decision(self, reason: str) -> Decision:
          """Create decision to end routing."""
          return EndDecision(reason=reason)
      

      get_route_decision

      get_route_decision(target: str, reason: str) -> Decision
      

      Create decision to route without waiting.

      Source code in src/llmling_agent/delegation/router.py
      119
      120
      121
      def get_route_decision(self, target: str, reason: str) -> Decision:
          """Create decision to route without waiting."""
          return RouteDecision(target_agent=target, reason=reason)
      

      get_wait_decision

      get_wait_decision(target: str, reason: str, talk_back: bool = False) -> Decision
      

      Create decision to route and wait for response.

      Source code in src/llmling_agent/delegation/router.py
      111
      112
      113
      114
      115
      116
      117
      def get_wait_decision(
          self, target: str, reason: str, talk_back: bool = False
      ) -> Decision:
          """Create decision to route and wait for response."""
          return AwaitResponseDecision(
              target_agent=target, reason=reason, talk_back=talk_back
          )
      

      Show source on GitHub