Agentic Harness can load model and provider defaults from JSON instead of requiring every app to wire them in Rust code.
Use runtime config for provider defaults, API-key environment variable names, and OpenAI-compatible model registration. Keep secrets in environment variables; do not write literal production API keys into repository config.
{
"defaultModel": "openai/gpt-5.5",
"openaiCompatibleModels": ["openai/gpt-5.5"],
"providers": {
"openai": {
"baseUrl": "https://api.openai.com/v1",
"apiKeyEnv": "OPENAI_API_KEY",
"headers": {
"X-Gateway": "example"
}
}
}
}If the file is in one of the workspace convention paths,
load_workspace_context will discover it automatically:
agentic-harness.json.agentic-harness/config.json
use agentic_harness::{AgentApp, AgenticHarnessError};
fn app() -> Result<AgentApp, AgenticHarnessError> {
AgentApp::new()
.with_workspace(".")
.load_workspace_context()
}Load an explicit file path when the config lives elsewhere:
use agentic_harness::{run_cli, AgentApp, AgenticHarnessError};
fn app() -> Result<AgentApp, AgenticHarnessError> {
AgentApp::new()
.load_runtime_config("agentic-harness.json")?
.load_workspace_context()
}defaultModel: agent-wide default model inprovider/model-idform.openaiCompatibleModels: models to register with the built-in OpenAI-compatible HTTP client.providers: provider runtime settings keyed by provider name.
Provider settings support:
baseUrl: provider or gateway base URL. The built-in client appends/chat/completions.apiKey: literal API key, useful for gateway dummy keys.apiKeyEnv: environment variable to read at request time.headers: extra provider headers.
The runtime still accepts manual Rust registration with AgentApp::model,
default_model, and providers; file config is a convenience layer over the
same model/provider runtime.
When a prompt is executed, model selection follows this order:
PromptOptions::model(...)- the selected role's
modelmetadata, when present defaultModelfrom runtime config
The selected model id must already be registered, either by runtime config or
manual Rust registration with AgentApp::model(...).
Provider settings are merged by provider name. A later runtime config call can override fields for the same provider.
openaiCompatibleModels registers model ids that use the built-in
chat-completions client. The provider part of the model id selects the provider
settings:
{
"defaultModel": "gateway/gpt-5.5",
"openaiCompatibleModels": ["gateway/gpt-5.5"],
"providers": {
"gateway": {
"baseUrl": "https://gateway.example/v1",
"apiKeyEnv": "GATEWAY_API_KEY"
}
}
}In non-native adapters, register a model with
OpenAiCompatibleModel::with_transport(...) so platform HTTP (for example
Worker fetch) handles the request.