Basic Usage
The simplest way to provide a system instruction is using a plain string:Prompt resolvers
The system prompt is built by a chain of resolvers, each handed what the last produced along with the run’s dependencies:agents.Dependencies carries what the agent contributes to its own prompt:
The default chain
prompts.DefaultResolvers() is the standard set, in this order:
Each section is skipped when the agent has nothing to contribute to it.
Custom resolvers
Pass what you want, in the order you want; repeatedWithResolver calls accumulate:
Template Variables
Use{{variable}} syntax in your instruction string, include prompts.ResolveTemplate in the chain, and supply the values through the run context:
{{variable}} is automatically converted to Go template format {{ .variable }} for resolution. A run that carries no RunContext leaves the prompt alone, so a prompt that happens to contain braces is not a failure for runs that never meant to template it.
prompts.DefaultResolver(prompt, data) is the same templating on its own, for callers who want it outside a resolver chain.
Skills
Skills are given to the agent throughAgentConfig.Skills, not through the prompt — the agent lists them and wires up the tool that reads them. The prompt’s only job is to include prompts.ResolveSkills so the catalogue is written into it.
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
- A prompt with no resolvers is used exactly as written — pass
prompts.WithResolver(prompts.DefaultResolvers()...)for the standard behaviour - 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