Using Instructions Files
Learn how to add contextual information and guidance to your Kit's Profiles and Provided resources using instruction files.
Using Instructions Files
Instructions provide a way to embed static, contextual information directly into your Kit definition. This text content is made available to Agents at runtime, helping guide their behavior within a specific Profile or providing context about Provided Resources.
Purpose of Instructions
- Agent Guidance: Provide specific directives, constraints, or background information to the Agent handling a Profile (e.g., "Always ask for confirmation before deleting data," "Format your output as a JSON object with keys 'summary' and 'keywords'").
- User Context (Indirect): While primarily for the Agent, well-written instructions can help the Agent formulate better prompts or explanations for the end-user.
- Context for Provided Resources: Explain the purpose or usage guidelines for Tools or Workspaces shared via the
provide
section inkit.yaml
.
Creating Instruction Files
- Location: Create your instruction files inside the
instructions/
directory at the root of your Kit. - Format: You can use plain text (
.txt
) or Markdown (.md
). Markdown is generally preferred as it allows for better formatting if the content needs to be displayed directly (though current primary use is agent context). Genbase reads the raw content of the file. - Content: Write clear, concise text relevant to the Profile or Provided Resource it will be associated with. Focus on information the Agent needs to perform its task effectively.
Example (instructions/maintenance_guide.md
):
Referencing Instructions in kit.yaml
You link instruction files to Profiles or Provided Resources within your kit.yaml
using the instructions
list:
instructions
List: Appears under aprofiles.<profile_name>
key or the top-levelprovide
key.name
: (Required) A unique identifier for the instruction within its list.path
: (Required) The filename (and path relative to theinstructions/
directory) of the instruction file.description
: (Optional) A brief description shown potentially in UI or used for context.
How Agents Access Instructions
When an Agent's process_request
method is called, the profile_data
argument (of type ProfileMetadataResult
) contains a list of instructions
relevant to the current context.
- For Profile Interactions: The
profile_data.instructions
list will contain all instructions defined under the current Profile inkit.yaml
. - For Interactions Using Provided Resources: If the interaction context involves resources provided by other modules, the
profile_data.instructions
list might also include instructions defined in theprovide.instructions
section of the providing Kit(s). (Note: The exact mechanism for including provided instructions might depend on the specific Agent implementation and how context is aggregated).
Accessing Content in Agent Code:
Each item in the profile_data.instructions
list is an InstructionItem
object (from engine.services.core.kit
) which includes the name
, path
, description
, and crucially, the pre-loaded file content
.
By using instruction files, you can keep detailed guidance and context separate from your core Agent logic and kit.yaml
configuration, making your Kit easier to manage and update.