Basic Usage
The simplest way to provide a system instruction is using a plain string:Template Variables
System instructions support template variables using Go template syntax. Variables are resolved at runtime using resolvers.Simple Template Variables
Use{{variable}} syntax in your instruction string, and provide a resolver to populate the values:
{{variable}} is automatically converted to Go template format {{ .variable }} for resolution.
Custom Resolvers
You can create custom resolvers functions for more complex template resolution logic. The resolver function will have access to the raw prompt and the run context.Skills
You can inject skills into the system prompt usingprompts.WithSkills. Each skill adds more specialised context, instructions and scripts that the agent can pull in when a task requires it.
agents.Skill fields are loaded from a skill’s SKILL.md:
Remote Prompts
You can load system instructions from the HasteKit Gateway server using ahastekitgateway.Config’s NewPrompt.
Parameters
name: The name of the prompt stored in the HasteKit Gateway serveralias: The prompt alias ("production"or"latest")
For this to work, you should have configured the
hastekitgateway.Config with the gateway’s endpoint, organisation name, project name and an API key.Remote Prompt with Resolvers
You can combine remote prompts with resolvers for dynamic content:Custom Prompt Loaders
For advanced use cases, you can implement a customPromptLoader interface to load prompts from any source:
Complete Example
Here’s a complete example demonstrating different ways to use system instructions:Notes
- Template variables use the syntax
{{variable}}which is automatically converted to Go template format - Remote prompts require the SDK client to be initialized with
endpoint, organisation name andprojectName - Custom prompt loaders must implement the
PromptLoaderinterface with aLoadPrompt(ctx context.Context) (string, error)method