ApiLoader for API-based loading and FileLoader for static file loading.
ApiLoader
TheApiLoader fetches prompts from the AgentMark API (Cloud) or a local development server.
Installation
Cloud mode (production)
Use Cloud mode when deploying to production with AgentMark Cloud:Local mode (development)
Use local mode during development with theagentmark dev server:
Usage with client
Pass the loader tocreateAgentMark and the client renders each prompt to the neutral shape ({ messages, text_config }); your code or an executor calls the model.
ApiLoader.cloud when AGENTMARK_API_KEY is present, ApiLoader.local otherwise).
Caching
TheApiLoader includes built-in caching. You can customize caching behavior when loading prompts:
Loading datasets
TheApiLoader can also stream datasets for experiments:
FileLoader
TheFileLoader loads pre-built prompts from JSON files generated by agentmark build. Use this for self-hosted deployments where you don’t want runtime API calls.
Installation
Building prompts
First, compile your prompts using the CLI:Usage
Path resolution
TheFileLoader accepts prompt paths with or without extensions:
Usage with client
Pass it tocreateAgentMark({ loader }) exactly like ApiLoader. See Client setup.
Loading datasets
TheFileLoader can also load dataset files (.jsonl):
Security
TheFileLoader includes path traversal protection:
- Rejects absolute paths
- Validates that resolved paths stay within the base directory
- Prevents access to files outside the build directory
Choosing a loader
Trade-offs
ApiLoader (Cloud)- Prompts managed in AgentMark Cloud
- Real-time updates without redeployment
- Requires network connectivity to AgentMark
- Built-in caching
- Fast development iteration
- Hot reloading with
agentmark dev - No AgentMark authentication required
- Zero network latency
- Works offline / air-gapped
- Requires rebuild for prompt changes
- Smaller bundle (no API client code)
Have questions?
Reach out any time:
- Email the team at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about AgentMark’s business solutions