Skip to content

Resources provide dynamic content that can be accessed by agents during execution. They allow agents to fetch data from various sources like files, CLI commands, source code, and external systems.

Overview

LLMling-Agent supports multiple resource types:

  • Path: Load content from file paths with pattern matching
  • Text: Static text content with optional templating
  • CLI: Execute command-line tools and capture output
  • Source: Extract source code from Python modules and classes
  • LangChain: Integration with LangChain document loaders
  • Callable: Custom Python functions that return content

Resources are loaded on-demand when agents request them, supporting parameterization for dynamic content generation.

Configuration Reference

PathResourceLoaderConfig

Resource loaded from a file or URL.

PathResourceLoaderConfig (YAML)
1
2
3
4
5
- type: path
  path: /path/to/file.txt  # Path to the file or URL to load.
  watch: null  # Configuration for watching the file for changes.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

TextResourceLoaderConfig

Raw text resource.

TextResourceLoaderConfig (YAML)
1
2
3
4
- type: text
  content: Hello World  # The actual text content of the resource.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

CLIResourceLoaderConfig

Resource from CLI command execution.

CLIResourceLoaderConfig (YAML)
1
2
3
4
5
6
7
- type: cli
  command: ls -la  # Command to execute (string or sequence of arguments).
  shell: false  # Whether to run the command through a shell.
  cwd: null  # Working directory for command execution.
  timeout: null  # Maximum time in seconds to wait for command completion.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

SourceResourceLoaderConfig

Resource from Python source code.

SourceResourceLoaderConfig (YAML)
1
2
3
4
5
6
- type: source
  import_path: mypackage.module  # Dotted import path to the Python module or object.
  recursive: false  # Whether to include submodules recursively.
  include_tests: false  # Whether to include test files and directories.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

LangChainResourceLoader

Wrapper for LangChain document loaders.

LangChainResourceLoader (YAML)
1
2
3
4
5
- type: langchain
  loader_class: langchain.document_loaders.TextLoader  # Import path to LangChain loader class.
  loader_args: {}  # Arguments for loader initialization.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

CallableResourceLoaderConfig

Resource from executing a Python callable.

CallableResourceLoaderConfig (YAML)
1
2
3
4
5
- type: callable
  import_path: mymodule.get_data  # Dotted import path to the callable to execute.
  keyword_args: {}  # Keyword arguments to pass to the callable.
  description: ''  # Human-readable description of the resource.
  uri: null  # Canonical URI for this resource, set during registration if unset.

Key Features

  • On-demand loading: Resources are loaded only when requested
  • Parameterization: Pass parameters to resources for dynamic content
  • Caching: Optional caching to improve performance
  • Pattern matching: Use glob patterns to load multiple files
  • Content processing: Transform and filter content before delivery
  • Access control: Restrict resource access through capabilities

Use Cases

  • Documentation: Provide agents with access to project documentation
  • Code analysis: Give agents access to source code for review or modification
  • Data access: Load configuration files, datasets, or API responses
  • Dynamic content: Generate content based on current state or parameters
  • External integration: Fetch data from external systems and tools

Configuration Notes

  • Resources can be defined at manifest level (global) or agent level (local)
  • Path resources support glob patterns for batch loading
  • CLI resources execute in the system shell with security considerations
  • Source resources automatically extract docstrings and type hints
  • LangChain resources leverage the extensive LangChain loader ecosystem
  • Callable resources provide maximum flexibility for custom logic