Skip to content

environment

Class info

Classes

Name Children Inherits
FileEnvironment
llmling_agent.models.environment
File-based environment configuration.
    InlineEnvironment
    llmling_agent.models.environment
    Direct environment configuration without external files.

      🛈 DocStrings

      FileEnvironment

      Bases: BaseModel

      File-based environment configuration.

      Loads environment settings from external YAML files, supporting: - Reusable environment configurations - Separation of concerns - Environment sharing between agents - Version control of environment settings

      Source code in src/llmling_agent/models/environment.py
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      class FileEnvironment(BaseModel):
          """File-based environment configuration.
      
          Loads environment settings from external YAML files, supporting:
          - Reusable environment configurations
          - Separation of concerns
          - Environment sharing between agents
          - Version control of environment settings
          """
      
          type: Literal["file"] = Field("file", init=False)
          """File-based runtime config."""
      
          uri: str = Field(min_length=1)
          """"Path to environment file."""
      
          config_file_path: str | None = None
          """Path to agent config file for resolving relative paths"""
      
          model_config = ConfigDict(frozen=True, use_attribute_docstrings=True, extra="forbid")
      
          def get_display_name(self) -> str:
              return f"File: {self.uri}"
      
          def get_file_path(self) -> str:
              """Get resolved file path."""
              from upath import UPath
      
              if self.config_file_path:
                  base_dir = UPath(self.config_file_path).parent
                  return str(base_dir / self.uri)
              return self.uri
      
          def get_config(self) -> Config:
              """Get runtime configuration."""
              return Config.from_file(self.get_file_path())
      

      config_file_path class-attribute instance-attribute

      config_file_path: str | None = None
      

      Path to agent config file for resolving relative paths

      type class-attribute instance-attribute

      type: Literal['file'] = Field('file', init=False)
      

      File-based runtime config.

      uri class-attribute instance-attribute

      uri: str = Field(min_length=1)
      

      "Path to environment file.

      get_config

      get_config() -> Config
      

      Get runtime configuration.

      Source code in src/llmling_agent/models/environment.py
      42
      43
      44
      def get_config(self) -> Config:
          """Get runtime configuration."""
          return Config.from_file(self.get_file_path())
      

      get_file_path

      get_file_path() -> str
      

      Get resolved file path.

      Source code in src/llmling_agent/models/environment.py
      33
      34
      35
      36
      37
      38
      39
      40
      def get_file_path(self) -> str:
          """Get resolved file path."""
          from upath import UPath
      
          if self.config_file_path:
              base_dir = UPath(self.config_file_path).parent
              return str(base_dir / self.uri)
          return self.uri
      

      InlineEnvironment

      Bases: Config

      Direct environment configuration without external files.

      Allows embedding complete environment settings directly in the agent configuration instead of referencing external files. Useful for: - Self-contained configurations - Testing and development - Simple agent setups

      Source code in src/llmling_agent/models/environment.py
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      class InlineEnvironment(Config):
          """Direct environment configuration without external files.
      
          Allows embedding complete environment settings directly in the agent
          configuration instead of referencing external files. Useful for:
          - Self-contained configurations
          - Testing and development
          - Simple agent setups
          """
      
          type: Literal["inline"] = Field("inline", init=False)
          """Inline-defined runtime config."""
      
          uri: str | None = None
          """Optional identifier for this configuration"""
      
          config_file_path: str | None = None
          """Path to agent config file for resolving relative paths"""
      
          model_config = ConfigDict(frozen=True)
      
          def get_display_name(self) -> str:
              return f"Inline: {self.uri}" if self.uri else "Inline configuration"
      
          def get_file_path(self) -> str | None:
              """No file path for inline environments."""
              return None
      
          def get_config(self) -> Config:
              """Get runtime configuration."""
              return self
      
          @classmethod
          def from_config(
              cls,
              config: Config,
              uri: str | None = None,
              config_file_path: str | None = None,
          ) -> InlineEnvironment:
              """Create inline environment from config."""
              return cls(**config.model_dump(), uri=uri)
      

      config_file_path class-attribute instance-attribute

      config_file_path: str | None = None
      

      Path to agent config file for resolving relative paths

      type class-attribute instance-attribute

      type: Literal['inline'] = Field('inline', init=False)
      

      Inline-defined runtime config.

      uri class-attribute instance-attribute

      uri: str | None = None
      

      Optional identifier for this configuration

      from_config classmethod

      from_config(
          config: Config, uri: str | None = None, config_file_path: str | None = None
      ) -> InlineEnvironment
      

      Create inline environment from config.

      Source code in src/llmling_agent/models/environment.py
      80
      81
      82
      83
      84
      85
      86
      87
      88
      @classmethod
      def from_config(
          cls,
          config: Config,
          uri: str | None = None,
          config_file_path: str | None = None,
      ) -> InlineEnvironment:
          """Create inline environment from config."""
          return cls(**config.model_dump(), uri=uri)
      

      get_config

      get_config() -> Config
      

      Get runtime configuration.

      Source code in src/llmling_agent/models/environment.py
      76
      77
      78
      def get_config(self) -> Config:
          """Get runtime configuration."""
          return self
      

      get_file_path

      get_file_path() -> str | None
      

      No file path for inline environments.

      Source code in src/llmling_agent/models/environment.py
      72
      73
      74
      def get_file_path(self) -> str | None:
          """No file path for inline environments."""
          return None