Skip to main content
System instructions define the behavior and personality of an agent. The SDK provides flexible ways to create system instructions, from simple strings to dynamic templates loaded from remote sources.

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:
A prompt starts with an empty chain and is used exactly as written — nothing appended, no templating. If you want the standard behaviour, you must ask for it with prompts.WithResolver(prompts.DefaultResolvers()...). A prompt that leaves out ResolveSkills produces an agent whose model never hears about its skills; one that leaves out ResolveTemplate leaves its {{ placeholders }} alone.

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; repeated WithResolver 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:
The template syntax {{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 through AgentConfig.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.
See Skills for the full picture.

Remote Prompts

You can load system instructions from the HasteKit Gateway server using a hastekitgateway.Config’s NewPrompt.

Parameters

  • name: The name of the prompt stored in the HasteKit Gateway server
  • alias: 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 custom PromptLoader 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 and projectName
  • Custom prompt loaders must implement the PromptLoader interface with a LoadPrompt(ctx context.Context) (string, error) method