CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
feat(agent): widen model type to accept FallbackBoundModel
xf gongba4ee8711d91
diff --git a/cubepi/agent/agent.py b/cubepi/agent/agent.pyindex 21918e9..68d3547 100644--- a/cubepi/agent/agent.py+++ b/cubepi/agent/agent.py@@ -5,7 +5,7 @@ import timeimport uuidfrom collections.abc import Sequencefrom dataclasses import dataclass, field-from typing import Callable, Generic, TypeVar+from typing import TYPE_CHECKING, Callable, Generic, TypeVarfrom cubepi.agent._outcome import RunOutcomefrom cubepi.agent._tool_cycle import ToolCycleViolation, check_tool_cycle@@ -49,6 +49,9 @@ from cubepi.types import JsonObject, StructuredValueTMessage = TypeVar("TMessage")+if TYPE_CHECKING:+ from cubepi.providers.fallback import FallbackBoundModel+def _default_convert_to_llm(messages: list[Message], *, ctx: AgentContext@@ -138,7 +141,7 @@ class Agent(Generic[TMessage]):def __init__(self,*,- model: BoundModel,+ model: BoundModel | FallbackBoundModel,system_prompt: str = "",tools: list[AgentTool] | None = None,thinking: ThinkingLevel = "off",diff --git a/cubepi/agent/loop.py b/cubepi/agent/loop.pyindex 22f4ad8..56f4942 100644--- a/cubepi/agent/loop.py+++ b/cubepi/agent/loop.py@@ -1,7 +1,7 @@from __future__ import annotationsimport asyncio-from typing import Callable+from typing import TYPE_CHECKING, Callablefrom cubepi.agent.tools import execute_tool_callsfrom cubepi.agent.types import (@@ -27,12 +27,15 @@ from cubepi.providers.base import (ToolResultMessage,)+if TYPE_CHECKING:+ from cubepi.providers.fallback import FallbackBoundModel+async def run_agent_loop(*,prompts: list[Message],context: AgentContext,- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,emit: Callable,transform_context: Callable | None = None,@@ -90,7 +93,7 @@ async def run_agent_loop(async def run_agent_loop_continue(*,context: AgentContext,- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,emit: Callable,transform_context: Callable | None = None,@@ -148,7 +151,7 @@ async def run_agent_loop_continue(async def run_agent_loop_resume(*,context: AgentContext,- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,emit: Callable,transform_context: Callable | None = None,@@ -387,7 +390,7 @@ async def _run_loop(*,current_context: AgentContext,new_messages: list[Message],- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,transform_context: Callable | None,transform_system_prompt: Callable | None,@@ -443,7 +446,7 @@ async def _run_loop_inner(*,current_context: AgentContext,new_messages: list[Message],- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,transform_context: Callable | None,transform_system_prompt: Callable | None,@@ -683,7 +686,7 @@ async def _run_loop_inner(async def _stream_assistant_response(context: AgentContext,- model: BoundModel,+ model: BoundModel | FallbackBoundModel,convert_to_llm: Callable,transform_context: Callable | None,transform_system_prompt: Callable | None,