Skip to main content

Agent Router

Agent routers: CRUD plus member management.

Access it as client.agent_router on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate)
for agent in client.agent_router.list():
print(agent.id)

# Create
created = client.agent_router.create(
name="...",
strategy="priority",
members=[{"modelId": "model_abc", "priority": 1}],
)
print(created.id)

# Read it back
fetched = client.agent_router.retrieve(created.id)

# Delete (returns None; raises on failure)
client.agent_router.delete(created.id)

Methods

Core

list

list() -> List[AgentRouter]

List the caller's agent routers.

create

create(*, name: str, strategy: str, description: Optional[str] = None, members: Optional[Sequence[Mapping[str, Any]]] = None, fallback_behavior: Optional[str] = None, routellm_config: Optional[Mapping[str, Any]] = None, complexity_config: Optional[Mapping[str, Any]] = None, content_type_config: Optional[Mapping[str, Any]] = None, bandit_config: Optional[Mapping[str, Any]] = None) -> AgentRouter

Create an agent router.

Args: name: Router name (required). strategy: Routing strategy (required), e.g. priority, weighted, cost-optimized, latency-optimized, round-robin, routellm, canary (15 strategies total). description: Router description. members: Member models as plain dicts with camelCase wire keys, e.g. {"modelId": "model_abc", "weight": 50, "priority": 1}. fallback_behavior: next (try another) or error (fail). routellm_config: Config for the routellm strategy. complexity_config: Config for the complexity strategy. content_type_config: Config for the content-type strategy. bandit_config: Config for the bandit strategies.

retrieve

retrieve(router_id: str) -> AgentRouter

Retrieve a single agent router by id.

update

update(router_id: str, *, name: Optional[str] = None, strategy: Optional[str] = None, description: Optional[str] = None, members: Optional[Sequence[Mapping[str, Any]]] = None, fallback_behavior: Optional[str] = None) -> AgentRouter

Update an agent router and return the updated record. Pass members as plain dicts with camelCase wire keys.

delete

delete(router_id: str) -> None

Delete an agent router. Raises on failure; returns nothing.

Other

add_member

add_member(router_id: str, *, model_id: str, weight: Optional[float] = None, priority: Optional[int] = None, enabled: Optional[bool] = None, cost_per_1k_input: Optional[float] = None, cost_per_1k_output: Optional[float] = None, capabilities: Optional[Sequence[str]] = None) -> AgentRouter

Add a member model to a router and return the updated router.

Args: router_id: Router id. model_id: Model id to add (required). weight: Weight 0-100 (for the weighted strategy). priority: Priority, lower = preferred (for the priority strategy). enabled: Whether the member is enabled (default true server-side). cost_per_1k_input: Input cost per 1k tokens (for cost-optimized). cost_per_1k_output: Output cost per 1k tokens (for cost-optimized). capabilities: Capability tags for the member.

remove_member

remove_member(router_id: str, member_id: str) -> None

Remove a member agent from a router. Raises on failure; returns nothing.