Skip to content

A programming framework for agentic AI

Rename modules (#45)

Jack Gerritsc0143069f441
diff --git a/README.md b/README.md
index 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.md
index 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 AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
# Create the token provider
diff --git a/docs/src/index.rst b/docs/src/index.rst
index 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.application
reference/agnext.chat
reference/agnext.core
diff --git a/examples/futures.py b/examples/futures.py
index aa38157b6..654767948 100644
--- a/examples/futures.py
+++ b/examples/futures.py
@@ -1,8 +1,8 @@
import asyncio
from 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_handler
from agnext.core import Agent, AgentRuntime, CancellationToken
diff --git a/examples/orchestrator.py b/examples/orchestrator.py
index 840d35a39..f2bde7f6a 100644
--- a/examples/orchestrator.py
+++ b/examples/orchestrator.py
@@ -6,18 +6,18 @@ import os
from typing import Annotated, Callable
import 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 ChatCompletionAgent
from agnext.chat.agents.oai_assistant import OpenAIAssistantAgent
from agnext.chat.patterns.orchestrator_chat import OrchestratorChat
from 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 SystemMessage
from agnext.core import Agent, AgentRuntime
from agnext.core.intervention import DefaultInterventionHandler, DropMessage
from tavily import TavilyClient
diff --git a/src/agnext/agent_components/__init__.py b/src/agnext/agent_components/__init__.py
deleted file mode 100644
index 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__.py
new file mode 100644
index 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.py
similarity index 100%
rename from src/agnext/application_components/_single_threaded_agent_runtime.py
rename to src/agnext/application/_single_threaded_agent_runtime.py
diff --git a/src/agnext/application_components/logging/__init__.py b/src/agnext/application/logging/__init__.py
similarity index 100%
rename from src/agnext/application_components/logging/__init__.py
rename to src/agnext/application/logging/__init__.py
diff --git a/src/agnext/application_components/logging/_events.py b/src/agnext/application/logging/_events.py
similarity index 91%
rename from src/agnext/application_components/logging/_events.py
rename to src/agnext/application/logging/_events.py
index 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_NAME
logger = 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.py
similarity index 94%
rename from src/agnext/application_components/logging/_llm_usage.py
rename to src/agnext/application/logging/_llm_usage.py
index 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 handler
logger = logging.getLogger(EVENT_LOGGER_NAME)
diff --git a/src/agnext/application_components/__init__.py b/src/agnext/application_components/__init__.py
deleted file mode 100644
index 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.py
index 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 asyncio
import json
from 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 BaseChatAgent
from 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, CancellationToken
diff --git a/src/agnext/chat/agents/oai_assistant.py b/src/agnext/chat/agents/oai_assistant.py
index 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, Mapping
import openai
from openai.types.beta import AssistantResponseFormatParam
-from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.chat.agents.base import BaseChatAgent
from agnext.chat.types import Reset, RespondNow, ResponseFormat, TextMessage
+from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.core import AgentRuntime, CancellationToken
diff --git a/src/agnext/chat/patterns/group_chat.py b/src/agnext/chat/patterns/group_chat.py
index 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_handler
from ...core import AgentRuntime, CancellationToken
from ..agents.base import BaseChatAgent
from ..types import Reset, RespondNow, TextMessage
diff --git a/src/agnext/chat/patterns/orchestrator_chat.py b/src/agnext/chat/patterns/orchestrator_chat.py
index 6f920a16b..4a3903e82 100644
--- a/src/agnext/chat/patterns/orchestrator_chat.py
+++ b/src/agnext/chat/patterns/orchestrator_chat.py
@@ -1,7 +1,7 @@
import json
from typing import Any, Sequence, Tuple
-from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler
+from ...components.type_routed_agent import TypeRoutedAgent, message_handler
from ...core import AgentRuntime, CancellationToken
from ..agents.base import BaseChatAgent
from ..types import Reset, RespondNow, ResponseFormat, TextMessage
diff --git a/src/agnext/chat/types.py b/src/agnext/chat/types.py
index 4cbf7998c..159b6994f 100644
--- a/src/agnext/chat/types.py
+++ b/src/agnext/chat/types.py
@@ -4,8 +4,8 @@ from dataclasses import dataclass, field
from enum import Enum
from 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.py
index 35b126f29..493926ad9 100644
--- a/src/agnext/chat/utils.py
+++ b/src/agnext/chat/utils.py
@@ -2,24 +2,24 @@ from typing import List, Optional, Union
from 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__.py
new file mode 100644
index 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__.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/__init__.py
rename to src/agnext/components/code_executor/__init__.py
diff --git a/src/agnext/agent_components/code_executor/_base.py b/src/agnext/components/code_executor/_base.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/_base.py
rename to src/agnext/components/code_executor/_base.py
diff --git a/src/agnext/agent_components/code_executor/_impl/__init__.py b/src/agnext/components/code_executor/_impl/__init__.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/_impl/__init__.py
rename to src/agnext/components/code_executor/_impl/__init__.py
diff --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.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/_impl/command_line_code_result.py
rename to src/agnext/components/code_executor/_impl/command_line_code_result.py
diff --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.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/_impl/local_commandline_code_executor.py
rename to src/agnext/components/code_executor/_impl/local_commandline_code_executor.py
diff --git a/src/agnext/agent_components/code_executor/_impl/utils.py b/src/agnext/components/code_executor/_impl/utils.py
similarity index 100%
rename from src/agnext/agent_components/code_executor/_impl/utils.py
rename to src/agnext/components/code_executor/_impl/utils.py
diff --git a/src/agnext/agent_components/func_with_reqs.py b/src/agnext/components/func_with_reqs.py
similarity index 100%
rename from src/agnext/agent_components/func_with_reqs.py
rename to src/agnext/components/func_with_reqs.py
diff --git a/src/agnext/agent_components/function_executor/__init__.py b/src/agnext/components/function_executor/__init__.py
similarity index 100%
rename from src/agnext/agent_components/function_executor/__init__.py
rename to src/agnext/components/function_executor/__init__.py
diff --git a/src/agnext/agent_components/function_executor/_base.py b/src/agnext/components/function_executor/_base.py
similarity index 100%
rename from src/agnext/agent_components/function_executor/_base.py
rename to src/agnext/components/function_executor/_base.py
diff --git a/src/agnext/agent_components/function_executor/_impl/__init__.py b/src/agnext/components/function_executor/_impl/__init__.py
similarity index 100%
rename from src/agnext/agent_components/function_executor/_impl/__init__.py
rename to src/agnext/components/function_executor/_impl/__init__.py
diff --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.py
similarity index 100%
rename from src/agnext/agent_components/function_executor/_impl/in_process_function_executor.py
rename to src/agnext/components/function_executor/_impl/in_process_function_executor.py
diff --git a/src/agnext/agent_components/function_utils.py b/src/agnext/components/function_utils.py
similarity index 100%
rename from src/agnext/agent_components/function_utils.py
rename to src/agnext/components/function_utils.py
diff --git a/src/agnext/agent_components/image.py b/src/agnext/components/image.py
similarity index 100%
rename from src/agnext/agent_components/image.py
rename to src/agnext/components/image.py
diff --git a/src/agnext/agent_components/model_client/__init__.py b/src/agnext/components/model_client/__init__.py
similarity index 100%
rename from src/agnext/agent_components/model_client/__init__.py
rename to src/agnext/components/model_client/__init__.py
diff --git a/src/agnext/agent_components/model_client/_model_client.py b/src/agnext/components/model_client/_model_client.py
similarity index 100%
rename from src/agnext/agent_components/model_client/_model_client.py
rename to src/agnext/components/model_client/_model_client.py
diff --git a/src/agnext/agent_components/model_client/_model_info.py b/src/agnext/components/model_client/_model_info.py
similarity index 100%
rename from src/agnext/agent_components/model_client/_model_info.py
rename to src/agnext/components/model_client/_model_info.py
diff --git a/src/agnext/agent_components/model_client/_openai_client.py b/src/agnext/components/model_client/_openai_client.py
similarity index 99%
rename from src/agnext/agent_components/model_client/_openai_client.py
rename to src/agnext/components/model_client/_openai_client.py
index 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 type2schema
from ..image import Image
diff --git a/src/agnext/agent_components/pydantic_compat.py b/src/agnext/components/pydantic_compat.py
similarity index 100%
rename from src/agnext/agent_components/pydantic_compat.py
rename to src/agnext/components/pydantic_compat.py
diff --git a/src/agnext/agent_components/type_routed_agent.py b/src/agnext/components/type_routed_agent.py
similarity index 100%
rename from src/agnext/agent_components/type_routed_agent.py
rename to src/agnext/components/type_routed_agent.py
diff --git a/src/agnext/agent_components/types.py b/src/agnext/components/types.py
similarity index 100%
rename from src/agnext/agent_components/types.py
rename to src/agnext/components/types.py
diff --git a/tests/execution/test_commandline_code_executor.py b/tests/execution/test_commandline_code_executor.py
index 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 Path
import pytest
-from agnext.agent_components.code_executor import LocalCommandLineCodeExecutor, CodeBlock
+from agnext.components.code_executor import LocalCommandLineCodeExecutor, CodeBlock
UNIX_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.py
index 6db7ebc4f..7c7b6eff0 100644
--- a/tests/execution/test_user_defined_functions.py
+++ b/tests/execution/test_user_defined_functions.py
@@ -5,11 +5,11 @@ import tempfile
import polars
import 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.py
index d82b40096..3555a63ea 100644
--- a/tests/test_cancellation.py
+++ b/tests/test_cancellation.py
@@ -2,8 +2,8 @@ import asyncio
import pytest
from 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 SingleThreadedAgentRuntime
from agnext.core import Agent
from agnext.core import AgentRuntime
from agnext.core import CancellationToken
diff --git a/tests/test_intervention.py b/tests/test_intervention.py
index 6e786bc0c..1a5af25b2 100644
--- a/tests/test_intervention.py
+++ b/tests/test_intervention.py
@@ -1,8 +1,8 @@
import pytest
from 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 SingleThreadedAgentRuntime
from agnext.core import Agent
from agnext.core import AgentRuntime
from agnext.core import CancellationToken
diff --git a/tests/test_llm_usage.py b/tests/test_llm_usage.py
index 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, LLMCallEvent
import logging
diff --git a/tests/test_runtime.py b/tests/test_runtime.py
index c69534d43..d47771e93 100644
--- a/tests/test_runtime.py
+++ b/tests/test_runtime.py
@@ -1,7 +1,7 @@
from typing import Any, Sequence
import pytest
-from agnext.application_components import SingleThreadedAgentRuntime
+from agnext.application import SingleThreadedAgentRuntime
from agnext.core import AgentRuntime
from agnext.core import BaseAgent
from agnext.core import CancellationToken
diff --git a/tests/test_state.py b/tests/test_state.py
index 0c8fb8e14..f0db7de59 100644
--- a/tests/test_state.py
+++ b/tests/test_state.py
@@ -1,7 +1,7 @@
from typing import Any, Mapping, Sequence
import pytest
-from agnext.application_components import SingleThreadedAgentRuntime
+from agnext.application import SingleThreadedAgentRuntime
from agnext.core import AgentRuntime
from agnext.core import BaseAgent
from agnext.core import CancellationToken