A programming framework for agentic AI
Rename modules (#45)
Jack Gerritsc0143069f441
diff --git a/README.md b/README.mdindex 403c54751..471a47418 100644--- a/README.md+++ b/README.md@@ -3,8 +3,8 @@## Package layering- `core` are the the foundational generic interfaces upon which all else is built. This module must not depend on any other module.-- `agent_components` are the building blocks for creating single agents-- `application_components` are implementations of core components that are used to compose an application+- `components` are the building blocks for creating single agents+- `application` are implementations of core components that are used to compose an application- `chat` is the concrete implementation of multi-agent interactions. Most users will deal with this module.diff --git a/docs/src/guides/azure_openai_with_aad_auth.md b/docs/src/guides/azure_openai_with_aad_auth.mdindex 689158bdb..5dc5daaf4 100644--- a/docs/src/guides/azure_openai_with_aad_auth.md+++ b/docs/src/guides/azure_openai_with_aad_auth.md@@ -15,7 +15,7 @@ pip install azure-identity## Using the Model Client```python-from agnext.agent_components.model_client import AzureOpenAI+from agnext.components.model_client import AzureOpenAIfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider# Create the token providerdiff --git a/docs/src/index.rst b/docs/src/index.rstindex 2ab4000c6..53f8eba86 100644--- a/docs/src/index.rst+++ b/docs/src/index.rst@@ -18,7 +18,7 @@ agnext:caption: Reference:hidden:- reference/agnext.agent_components- reference/agnext.application_components+ reference/agnext.components+ reference/agnext.applicationreference/agnext.chatreference/agnext.corediff --git a/examples/futures.py b/examples/futures.pyindex aa38157b6..654767948 100644--- a/examples/futures.py+++ b/examples/futures.py@@ -1,8 +1,8 @@import asynciofrom dataclasses import dataclass-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler-from agnext.application_components import SingleThreadedAgentRuntime+from agnext.application import SingleThreadedAgentRuntime+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handlerfrom agnext.core import Agent, AgentRuntime, CancellationTokendiff --git a/examples/orchestrator.py b/examples/orchestrator.pyindex 840d35a39..f2bde7f6a 100644--- a/examples/orchestrator.py+++ b/examples/orchestrator.py@@ -6,18 +6,18 @@ import osfrom typing import Annotated, Callableimport openai-from agnext.agent_components.function_executor._impl.in_process_function_executor import (- InProcessFunctionExecutor,-)-from agnext.agent_components.model_client import OpenAI-from agnext.agent_components.types import SystemMessage-from agnext.application_components import (+from agnext.application import (SingleThreadedAgentRuntime,)from agnext.chat.agents.chat_completion_agent import ChatCompletionAgentfrom agnext.chat.agents.oai_assistant import OpenAIAssistantAgentfrom agnext.chat.patterns.orchestrator_chat import OrchestratorChatfrom agnext.chat.types import TextMessage+from agnext.components.function_executor._impl.in_process_function_executor import (+ InProcessFunctionExecutor,+)+from agnext.components.model_client import OpenAI+from agnext.components.types import SystemMessagefrom agnext.core import Agent, AgentRuntimefrom agnext.core.intervention import DefaultInterventionHandler, DropMessagefrom tavily import TavilyClientdiff --git a/src/agnext/agent_components/__init__.py b/src/agnext/agent_components/__init__.pydeleted file mode 100644index 30d509be0..000000000--- a/src/agnext/agent_components/__init__.py+++ /dev/null@@ -1,3 +0,0 @@-"""-The :mod:`agnext.agent_components` module provides building blocks for creating single agents-"""diff --git a/src/agnext/application/__init__.py b/src/agnext/application/__init__.pynew file mode 100644index 000000000..72aac4583--- /dev/null+++ b/src/agnext/application/__init__.py@@ -0,0 +1,7 @@+"""+The :mod:`agnext.application` module provides implementations of core components that are used to compose an application+"""++from ._single_threaded_agent_runtime import SingleThreadedAgentRuntime++__all__ = ["SingleThreadedAgentRuntime"]diff --git a/src/agnext/application_components/_single_threaded_agent_runtime.py b/src/agnext/application/_single_threaded_agent_runtime.pysimilarity index 100%rename from src/agnext/application_components/_single_threaded_agent_runtime.pyrename to src/agnext/application/_single_threaded_agent_runtime.pydiff --git a/src/agnext/application_components/logging/__init__.py b/src/agnext/application/logging/__init__.pysimilarity index 100%rename from src/agnext/application_components/logging/__init__.pyrename to src/agnext/application/logging/__init__.pydiff --git a/src/agnext/application_components/logging/_events.py b/src/agnext/application/logging/_events.pysimilarity index 91%rename from src/agnext/application_components/logging/_events.pyrename to src/agnext/application/logging/_events.pyindex 2d860cf0f..ae473b1f2 100644--- a/src/agnext/application_components/logging/_events.py+++ b/src/agnext/application/logging/_events.py@@ -14,7 +14,7 @@ class LLMCallEvent:.. code-block:: python- from agnext.application_components.logging import LLMCallEvent, EVENT_LOGGER_NAME+ from agnext.application.logging import LLMCallEvent, EVENT_LOGGER_NAMElogger = logging.getLogger(EVENT_LOGGER_NAME)logger.info(LLMCallEvent(prompt_tokens=10, completion_tokens=20))diff --git a/src/agnext/application_components/logging/_llm_usage.py b/src/agnext/application/logging/_llm_usage.pysimilarity index 94%rename from src/agnext/application_components/logging/_llm_usage.pyrename to src/agnext/application/logging/_llm_usage.pyindex 3deb2591b..0677b6fc9 100644--- a/src/agnext/application_components/logging/_llm_usage.py+++ b/src/agnext/application/logging/_llm_usage.py@@ -11,7 +11,7 @@ class LLMUsageTracker(logging.Handler):.. code-block:: python- from agnext.application_components.logging import LLMUsageTracker, EVENT_LOGGER_NAME+ from agnext.application.logging import LLMUsageTracker, EVENT_LOGGER_NAME# Set up the logging configuration to use the custom handlerlogger = logging.getLogger(EVENT_LOGGER_NAME)diff --git a/src/agnext/application_components/__init__.py b/src/agnext/application_components/__init__.pydeleted file mode 100644index 0f52606bf..000000000--- a/src/agnext/application_components/__init__.py+++ /dev/null@@ -1,7 +0,0 @@-"""-The :mod:`agnext.application_components` module provides implementations of core components that are used to compose an application-"""--from ._single_threaded_agent_runtime import SingleThreadedAgentRuntime--__all__ = ["SingleThreadedAgentRuntime"]diff --git a/src/agnext/chat/agents/chat_completion_agent.py b/src/agnext/chat/agents/chat_completion_agent.pyindex 3eb9f4f90..78c28bfb5 100644--- a/src/agnext/chat/agents/chat_completion_agent.py+++ b/src/agnext/chat/agents/chat_completion_agent.py@@ -2,14 +2,6 @@ import asyncioimport jsonfrom typing import Any, Coroutine, Dict, List, Mapping, Tuple-from agnext.agent_components.function_executor import FunctionExecutor-from agnext.agent_components.model_client import ModelClient-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler-from agnext.agent_components.types import (- FunctionCall,- FunctionSignature,- SystemMessage,-)from agnext.chat.agents.base import BaseChatAgentfrom agnext.chat.types import (FunctionCallMessage,@@ -22,6 +14,14 @@ from agnext.chat.types import (TextMessage,)from agnext.chat.utils import convert_messages_to_llm_messages+from agnext.components.function_executor import FunctionExecutor+from agnext.components.model_client import ModelClient+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler+from agnext.components.types import (+ FunctionCall,+ FunctionSignature,+ SystemMessage,+)from agnext.core import AgentRuntime, CancellationTokendiff --git a/src/agnext/chat/agents/oai_assistant.py b/src/agnext/chat/agents/oai_assistant.pyindex 7b1cff1f5..d121fd3cf 100644--- a/src/agnext/chat/agents/oai_assistant.py+++ b/src/agnext/chat/agents/oai_assistant.py@@ -3,9 +3,9 @@ from typing import Any, List, Mappingimport openaifrom openai.types.beta import AssistantResponseFormatParam-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handlerfrom agnext.chat.agents.base import BaseChatAgentfrom agnext.chat.types import Reset, RespondNow, ResponseFormat, TextMessage+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handlerfrom agnext.core import AgentRuntime, CancellationTokendiff --git a/src/agnext/chat/patterns/group_chat.py b/src/agnext/chat/patterns/group_chat.pyindex 098d6934b..2c08bceee 100644--- a/src/agnext/chat/patterns/group_chat.py+++ b/src/agnext/chat/patterns/group_chat.py@@ -1,6 +1,6 @@from typing import Any, List, Protocol, Sequence-from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler+from ...components.type_routed_agent import TypeRoutedAgent, message_handlerfrom ...core import AgentRuntime, CancellationTokenfrom ..agents.base import BaseChatAgentfrom ..types import Reset, RespondNow, TextMessagediff --git a/src/agnext/chat/patterns/orchestrator_chat.py b/src/agnext/chat/patterns/orchestrator_chat.pyindex 6f920a16b..4a3903e82 100644--- a/src/agnext/chat/patterns/orchestrator_chat.py+++ b/src/agnext/chat/patterns/orchestrator_chat.py@@ -1,7 +1,7 @@import jsonfrom typing import Any, Sequence, Tuple-from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler+from ...components.type_routed_agent import TypeRoutedAgent, message_handlerfrom ...core import AgentRuntime, CancellationTokenfrom ..agents.base import BaseChatAgentfrom ..types import Reset, RespondNow, ResponseFormat, TextMessagediff --git a/src/agnext/chat/types.py b/src/agnext/chat/types.pyindex 4cbf7998c..159b6994f 100644--- a/src/agnext/chat/types.py+++ b/src/agnext/chat/types.py@@ -4,8 +4,8 @@ from dataclasses import dataclass, fieldfrom enum import Enumfrom typing import List, Union-from agnext.agent_components.image import Image-from agnext.agent_components.types import FunctionCall+from agnext.components.image import Image+from agnext.components.types import FunctionCall@dataclass(kw_only=True)diff --git a/src/agnext/chat/utils.py b/src/agnext/chat/utils.pyindex 35b126f29..493926ad9 100644--- a/src/agnext/chat/utils.py+++ b/src/agnext/chat/utils.py@@ -2,24 +2,24 @@ from typing import List, Optional, Unionfrom typing_extensions import Literal-from agnext.agent_components.types import (+from agnext.chat.types import (+ FunctionCallMessage,+ FunctionExecutionResultMessage,+ Message,+ MultiModalMessage,+ TextMessage,+)+from agnext.components.types import (AssistantMessage,LLMMessage,UserMessage,)-from agnext.agent_components.types import (+from agnext.components.types import (FunctionExecutionResult as FunctionExecutionResultType,)-from agnext.agent_components.types import (+from agnext.components.types import (FunctionExecutionResultMessage as FunctionExecutionResultMessageType,)-from agnext.chat.types import (- FunctionCallMessage,- FunctionExecutionResultMessage,- Message,- MultiModalMessage,- TextMessage,-)def convert_content_message_to_assistant_message(diff --git a/src/agnext/components/__init__.py b/src/agnext/components/__init__.pynew file mode 100644index 000000000..2725f6641--- /dev/null+++ b/src/agnext/components/__init__.py@@ -0,0 +1,3 @@+"""+The :mod:`agnext.components` module provides building blocks for creating single agents+"""diff --git a/src/agnext/agent_components/code_executor/__init__.py b/src/agnext/components/code_executor/__init__.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/__init__.pyrename to src/agnext/components/code_executor/__init__.pydiff --git a/src/agnext/agent_components/code_executor/_base.py b/src/agnext/components/code_executor/_base.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/_base.pyrename to src/agnext/components/code_executor/_base.pydiff --git a/src/agnext/agent_components/code_executor/_impl/__init__.py b/src/agnext/components/code_executor/_impl/__init__.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/_impl/__init__.pyrename to src/agnext/components/code_executor/_impl/__init__.pydiff --git a/src/agnext/agent_components/code_executor/_impl/command_line_code_result.py b/src/agnext/components/code_executor/_impl/command_line_code_result.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/_impl/command_line_code_result.pyrename to src/agnext/components/code_executor/_impl/command_line_code_result.pydiff --git a/src/agnext/agent_components/code_executor/_impl/local_commandline_code_executor.py b/src/agnext/components/code_executor/_impl/local_commandline_code_executor.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/_impl/local_commandline_code_executor.pyrename to src/agnext/components/code_executor/_impl/local_commandline_code_executor.pydiff --git a/src/agnext/agent_components/code_executor/_impl/utils.py b/src/agnext/components/code_executor/_impl/utils.pysimilarity index 100%rename from src/agnext/agent_components/code_executor/_impl/utils.pyrename to src/agnext/components/code_executor/_impl/utils.pydiff --git a/src/agnext/agent_components/func_with_reqs.py b/src/agnext/components/func_with_reqs.pysimilarity index 100%rename from src/agnext/agent_components/func_with_reqs.pyrename to src/agnext/components/func_with_reqs.pydiff --git a/src/agnext/agent_components/function_executor/__init__.py b/src/agnext/components/function_executor/__init__.pysimilarity index 100%rename from src/agnext/agent_components/function_executor/__init__.pyrename to src/agnext/components/function_executor/__init__.pydiff --git a/src/agnext/agent_components/function_executor/_base.py b/src/agnext/components/function_executor/_base.pysimilarity index 100%rename from src/agnext/agent_components/function_executor/_base.pyrename to src/agnext/components/function_executor/_base.pydiff --git a/src/agnext/agent_components/function_executor/_impl/__init__.py b/src/agnext/components/function_executor/_impl/__init__.pysimilarity index 100%rename from src/agnext/agent_components/function_executor/_impl/__init__.pyrename to src/agnext/components/function_executor/_impl/__init__.pydiff --git a/src/agnext/agent_components/function_executor/_impl/in_process_function_executor.py b/src/agnext/components/function_executor/_impl/in_process_function_executor.pysimilarity index 100%rename from src/agnext/agent_components/function_executor/_impl/in_process_function_executor.pyrename to src/agnext/components/function_executor/_impl/in_process_function_executor.pydiff --git a/src/agnext/agent_components/function_utils.py b/src/agnext/components/function_utils.pysimilarity index 100%rename from src/agnext/agent_components/function_utils.pyrename to src/agnext/components/function_utils.pydiff --git a/src/agnext/agent_components/image.py b/src/agnext/components/image.pysimilarity index 100%rename from src/agnext/agent_components/image.pyrename to src/agnext/components/image.pydiff --git a/src/agnext/agent_components/model_client/__init__.py b/src/agnext/components/model_client/__init__.pysimilarity index 100%rename from src/agnext/agent_components/model_client/__init__.pyrename to src/agnext/components/model_client/__init__.pydiff --git a/src/agnext/agent_components/model_client/_model_client.py b/src/agnext/components/model_client/_model_client.pysimilarity index 100%rename from src/agnext/agent_components/model_client/_model_client.pyrename to src/agnext/components/model_client/_model_client.pydiff --git a/src/agnext/agent_components/model_client/_model_info.py b/src/agnext/components/model_client/_model_info.pysimilarity index 100%rename from src/agnext/agent_components/model_client/_model_info.pyrename to src/agnext/components/model_client/_model_info.pydiff --git a/src/agnext/agent_components/model_client/_openai_client.py b/src/agnext/components/model_client/_openai_client.pysimilarity index 99%rename from src/agnext/agent_components/model_client/_openai_client.pyrename to src/agnext/components/model_client/_openai_client.pyindex cdea77359..be890dbdd 100644--- a/src/agnext/agent_components/model_client/_openai_client.py+++ b/src/agnext/components/model_client/_openai_client.py@@ -32,7 +32,7 @@ from openai.types.chat import ()from typing_extensions import Required, TypedDict, Unpack-from ...application_components.logging import EVENT_LOGGER_NAME, LLMCallEvent+from ...application.logging import EVENT_LOGGER_NAME, LLMCallEvent# from ..._pydantic import type2schemafrom ..image import Imagediff --git a/src/agnext/agent_components/pydantic_compat.py b/src/agnext/components/pydantic_compat.pysimilarity index 100%rename from src/agnext/agent_components/pydantic_compat.pyrename to src/agnext/components/pydantic_compat.pydiff --git a/src/agnext/agent_components/type_routed_agent.py b/src/agnext/components/type_routed_agent.pysimilarity index 100%rename from src/agnext/agent_components/type_routed_agent.pyrename to src/agnext/components/type_routed_agent.pydiff --git a/src/agnext/agent_components/types.py b/src/agnext/components/types.pysimilarity index 100%rename from src/agnext/agent_components/types.pyrename to src/agnext/components/types.pydiff --git a/tests/execution/test_commandline_code_executor.py b/tests/execution/test_commandline_code_executor.pyindex 2df31d6e7..fb543d701 100644--- a/tests/execution/test_commandline_code_executor.py+++ b/tests/execution/test_commandline_code_executor.py@@ -7,7 +7,7 @@ from pathlib import Pathimport pytest-from agnext.agent_components.code_executor import LocalCommandLineCodeExecutor, CodeBlock+from agnext.components.code_executor import LocalCommandLineCodeExecutor, CodeBlockUNIX_SHELLS = ["bash", "sh", "shell"]WINDOWS_SHELLS = ["ps1", "pwsh", "powershell"]diff --git a/tests/execution/test_user_defined_functions.py b/tests/execution/test_user_defined_functions.pyindex 6db7ebc4f..7c7b6eff0 100644--- a/tests/execution/test_user_defined_functions.py+++ b/tests/execution/test_user_defined_functions.py@@ -5,11 +5,11 @@ import tempfileimport polarsimport pytest-from agnext.agent_components.code_executor import (+from agnext.components.code_executor import (CodeBlock,LocalCommandLineCodeExecutor,)-from agnext.agent_components.func_with_reqs import (+from agnext.components.func_with_reqs import (FunctionWithRequirements,with_requirements,)diff --git a/tests/test_cancellation.py b/tests/test_cancellation.pyindex d82b40096..3555a63ea 100644--- a/tests/test_cancellation.py+++ b/tests/test_cancellation.py@@ -2,8 +2,8 @@ import asyncioimport pytestfrom dataclasses import dataclass-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler-from agnext.application_components import SingleThreadedAgentRuntime+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler+from agnext.application import SingleThreadedAgentRuntimefrom agnext.core import Agentfrom agnext.core import AgentRuntimefrom agnext.core import CancellationTokendiff --git a/tests/test_intervention.py b/tests/test_intervention.pyindex 6e786bc0c..1a5af25b2 100644--- a/tests/test_intervention.py+++ b/tests/test_intervention.py@@ -1,8 +1,8 @@import pytestfrom dataclasses import dataclass-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler-from agnext.application_components import SingleThreadedAgentRuntime+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler+from agnext.application import SingleThreadedAgentRuntimefrom agnext.core import Agentfrom agnext.core import AgentRuntimefrom agnext.core import CancellationTokendiff --git a/tests/test_llm_usage.py b/tests/test_llm_usage.pyindex 2f3142663..5de57fa71 100644--- a/tests/test_llm_usage.py+++ b/tests/test_llm_usage.py@@ -1,4 +1,4 @@-from agnext.application_components.logging import LLMUsageTracker, EVENT_LOGGER_NAME, LLMCallEvent+from agnext.application.logging import LLMUsageTracker, EVENT_LOGGER_NAME, LLMCallEventimport loggingdiff --git a/tests/test_runtime.py b/tests/test_runtime.pyindex c69534d43..d47771e93 100644--- a/tests/test_runtime.py+++ b/tests/test_runtime.py@@ -1,7 +1,7 @@from typing import Any, Sequenceimport pytest-from agnext.application_components import SingleThreadedAgentRuntime+from agnext.application import SingleThreadedAgentRuntimefrom agnext.core import AgentRuntimefrom agnext.core import BaseAgentfrom agnext.core import CancellationTokendiff --git a/tests/test_state.py b/tests/test_state.pyindex 0c8fb8e14..f0db7de59 100644--- a/tests/test_state.py+++ b/tests/test_state.py@@ -1,7 +1,7 @@from typing import Any, Mapping, Sequenceimport pytest-from agnext.application_components import SingleThreadedAgentRuntime+from agnext.application import SingleThreadedAgentRuntimefrom agnext.core import AgentRuntimefrom agnext.core import BaseAgentfrom agnext.core import CancellationToken