Model Providers
All six SDKs route model calls through the shared Rust runtime, supporting
OpenAI-compatible APIs (openai_chat, openai_responses), Anthropic
(anthropic), Google Gemini (gemini), ordered ModelCascade fallbacks, and
offline test backends (MockModel in Python/Rust or host-language callbacks in
TypeScript, Go, C#, and Java). Keep provider keys in environment variables or
secure runtime configuration rather than source code.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
from ish import Agent, AnthropicModel, ModelCascade, OpenAICompatibleModel
cascade = ModelCascade(
[
OpenAICompatibleModel(model="gpt-4o-mini"),
AnthropicModel(model="claude-sonnet-4-6"),
]
)
agent = Agent(name="assistant", model=cascade)
import { Agent, ModelCascade } from "ish-harness";
const cascade = new ModelCascade([
{ provider: "openai_chat", name: "gpt-4o-mini" },
{ provider: "anthropic", name: "claude-sonnet-4-6" },
]);
const agent = new Agent({ name: "assistant", model: cascade });
use std::sync::Arc;
use ish_harness::models::model_backend_from_config;
use ish_harness::Agent;
use serde_json::json;
let cascade = model_backend_from_config(
&json!({
"providers": [
{ "provider": "openai_chat", "name": "gpt-4o-mini" },
{ "provider": "anthropic", "name": "claude-sonnet-4-6" }
]
}),
None,
)?;
let agent = Agent::builder(cascade).name("assistant").build()?;
cascade, err := ish.NewModelCascade([]ish.AgentModel{
{Provider: "openai_chat", Name: "gpt-4o-mini"},
{Provider: "anthropic", Name: "claude-sonnet-4-6"},
})
if err != nil {
panic(err)
}
agent := ish.NewAgent(client, ish.AgentRunRequest{
AgentName: "assistant",
Model: cascade.ToAgentModel(),
})
using Ish.Harness;
var cascade = new ModelCascade(
[
new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
new AgentModel { Provider = "anthropic", Name = "claude-sonnet-4-6" },
]);
var request = new AgentRunRequest
{
AgentName = "assistant",
Model = cascade.ToAgentModel(),
UserPrompt = "Hello",
};
import io.github.ishharness.IshClient;
import io.github.ishharness.ModelCascade;
import io.github.ishharness.ModelProviderOptions;
import java.util.List;
var cascade = ModelCascade.fromOptions(List.of(
new ModelProviderOptions("openai_chat", "gpt-4o-mini"),
new ModelProviderOptions("anthropic", "claude-sonnet-4-6")));
var request = new IshClient.AgentRequest("gpt-4o-mini", "Be concise.", "Hello")
.agentName("assistant")
.modelCascade(cascade);
Provider cascades (ModelCascade)
Configure ordered provider fallbacks evaluated by the Rust runtime:
A cascade configures fallback ordering according to failure classification and retry policy; it does not guarantee uninterrupted provider availability.
Offline model tests
Use MockModel or ReplayModel (Python), MockModel (Rust), or an in-process
host model callback (TypeScript, Go, C#, and Java) to run unit tests without
network requests:
- Python
- TypeScript
- Rust
- Go
- C#
- Java
from ish import ReplayModel
model = ReplayModel(fixtures=[{"content": "fixture response"}])
import { Agent } from "ish-harness";
const agent = new Agent({
name: "tester",
model: {
generate: () => ({ content: "fixture response" }),
},
});
use std::sync::Arc;
use ish_harness::data_plane::types::ModelResponse;
use ish_harness::{Agent, MockModel};
let response = ModelResponse {
content: Some("fixture response".to_string()),
tool_calls: vec![],
prompt_tokens: 0,
cached_prompt_tokens: 0,
cache_write_tokens: 0,
completion_tokens: 0,
reasoning_tokens: 0,
total_tokens: 0,
latency_ms: 0.0,
provider: None,
model: None,
estimated_cost_usd: None,
cost_rate_provenance: None,
};
let agent = Agent::builder(Arc::new(MockModel::new(vec![response]))).build()?;
agent := ish.NewAgent(client, ish.AgentRunRequest{
AgentName: "tester",
HostModel: func(ctx context.Context, req map[string]any) (map[string]any, error) {
return map[string]any{"content": "fixture response"}, nil
},
})
using Ish.Harness;
var request = new AgentRunRequest
{
AgentName = "tester",
UserPrompt = "Check pipeline",
HostModel = _ => new { content = "fixture response" },
};
import io.github.ishharness.IshClient;
import java.util.Map;
var request = new IshClient.AgentRequest("mock", "", "Check pipeline")
.agentName("tester")
.hostModel(req -> Map.of("content", "fixture response"));
See Model integrations for structured decisions
(model.decide), endpoint options, retry settings, and pricing rates.
DecisionsClient
All SDKs expose a typed DecisionsClient over Rust's model.decide. Questions are tagged JSON objects: {type: "predicate", name, instructions}, {type: "choice", name, instructions, choices: string[]}, or {type: "score", name, instructions, levels: string[]}. Do not use the former single_select / options shape. See the integration examples for all six language snippets.