Skip to content

Knowledge Sources

Knowledge defines context sources that are loaded when the agent starts: files and URLs (paths) and prompts (prompts) whose content is added to the agent's context. Resources that tools read on demand are configured separately (see Resources).

agents:
  research_assistant:
    model: openai:gpt-5-mini
    knowledge:
      # Files and URLs (any fsspec / UPath location, glob patterns allowed)
      paths:
        - "docs/**/*.md"
        - "https://example.com/api-docs.md"
        - "s3://bucket/context.txt"

      # Prompts whose content is loaded
      prompts:
        - type: file              # From a file (text, markdown or jinja2)
          path: prompts/context.md.j2
          format: jinja2
          description: Project context
        - type: function          # Returned by a Python function
          import_path: myapp.prompts.generate_context
          description: Live context
        - type: text              # Static messages
          description: House rules
          messages:
            - role: system
              content: "Answer in British English."

      convert_to_markdown: true  # Convert documents (PDF, HTML, ...) to markdown

Examples

Documentation Assistant

agents:
  docs_helper:
    model: openai:gpt-5-mini
    knowledge:
      paths: ["docs/**/*.md"]
      prompts:
        - type: file
          path: prompts/docs_context.txt
          description: How the docs are organized

Code Reviewer

agents:
  reviewer:
    model: openai:gpt-5-mini
    knowledge:
      paths: ["src/**/*.py", "CONTRIBUTING.md"]

Configuration Reference

Knowledge Configuration

Collection of context sources for an agent.

Supports both simple paths and rich resource types for content loading, plus AgentPool's prompt system for dynamic content generation.

Docs: https://phil65.github.io/agentpool/configuration/knowledge/

Knowledge Configuration (YAML)
1
2
3
4
knowledge:
  paths: []  # Quick access to files and URLs.
  prompts: []  # Prompts for dynamic content generation:
  convert_to_markdown: false  # Whether to convert content to markdown when possible.

StaticPrompt

Static prompt defined by message list.

StaticPrompt (YAML)
1
2
3
4
5
6
7
8
- messages:
  - role: system
    content: ''
  type: text  # Discriminator field identifying this as a static text prompt.
  arguments: []  # List of arguments that this prompt accepts.
  description: a  # Human-readable description of what this prompt does.
  title: null  # Title of the prompt.
  metadata: {}  # Additional metadata for storing custom prompt information.

DynamicPrompt

Dynamic prompt loaded from callable.

DynamicPrompt (YAML)
1
2
3
4
5
6
- import_path: a
  template: null  # Optional template string for formatting the callable's output.
  type: function  # Discriminator field identifying this as a function-based prompt.
  description: a  # Human-readable description of what this prompt does.
  title: null  # Title of the prompt.
  metadata: {}  # Additional metadata for storing custom prompt information.

FilePrompt

Prompt loaded from a file.

This type of prompt loads its content from a file, allowing for longer or more complex prompts to be managed in separate files. The file content is loaded and parsed according to the specified format.

FilePrompt (YAML)
1
2
3
4
5
6
7
- path: a
  fmt: text
  type: file  # Discriminator field identifying this as a file-based prompt.
  watch: false  # Whether to watch the file for changes and reload automatically.
  description: a  # Human-readable description of what this prompt does.
  title: null  # Title of the prompt.
  metadata: {}  # Additional metadata for storing custom prompt information.