agentex-sdk 0.4.19__py3-none-any.whl → 0.4.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentex/__init__.py +0 -1
- agentex/_utils/_typing.py +3 -1
- agentex/_version.py +1 -1
- agentex/lib/adk/__init__.py +3 -0
- agentex/lib/adk/_modules/acp.py +3 -1
- agentex/lib/adk/_modules/agent_task_tracker.py +3 -1
- agentex/lib/adk/_modules/agents.py +3 -1
- agentex/lib/adk/_modules/events.py +3 -1
- agentex/lib/adk/_modules/messages.py +3 -1
- agentex/lib/adk/_modules/state.py +3 -1
- agentex/lib/adk/_modules/streaming.py +3 -1
- agentex/lib/adk/_modules/tasks.py +4 -2
- agentex/lib/adk/_modules/tracing.py +3 -1
- agentex/lib/adk/providers/__init__.py +2 -2
- agentex/lib/adk/providers/_modules/litellm.py +10 -11
- agentex/lib/adk/providers/_modules/openai.py +27 -28
- agentex/lib/adk/providers/_modules/sgp.py +5 -6
- agentex/lib/adk/utils/_modules/client.py +4 -1
- agentex/lib/adk/utils/_modules/templating.py +5 -6
- agentex/lib/cli/commands/agents.py +21 -21
- agentex/lib/cli/commands/init.py +3 -3
- agentex/lib/cli/commands/main.py +3 -3
- agentex/lib/cli/commands/secrets.py +10 -10
- agentex/lib/cli/commands/tasks.py +26 -28
- agentex/lib/cli/commands/uv.py +1 -1
- agentex/lib/cli/debug/__init__.py +1 -1
- agentex/lib/cli/debug/debug_config.py +1 -2
- agentex/lib/cli/debug/debug_handlers.py +6 -4
- agentex/lib/cli/handlers/agent_handlers.py +15 -16
- agentex/lib/cli/handlers/cleanup_handlers.py +1 -1
- agentex/lib/cli/handlers/deploy_handlers.py +20 -39
- agentex/lib/cli/handlers/run_handlers.py +13 -16
- agentex/lib/cli/handlers/secret_handlers.py +25 -25
- agentex/lib/cli/templates/temporal/project/acp.py.j2 +11 -8
- agentex/lib/cli/utils/auth_utils.py +3 -2
- agentex/lib/cli/utils/credential_utils.py +1 -1
- agentex/lib/cli/utils/kubectl_utils.py +3 -3
- agentex/lib/cli/utils/kubernetes_secrets_utils.py +4 -4
- agentex/lib/cli/utils/path_utils.py +2 -2
- agentex/lib/core/adapters/llm/adapter_litellm.py +9 -4
- agentex/lib/core/adapters/llm/adapter_sgp.py +10 -7
- agentex/lib/core/adapters/llm/port.py +1 -1
- agentex/lib/core/adapters/streams/adapter_redis.py +7 -4
- agentex/lib/core/adapters/streams/port.py +1 -1
- agentex/lib/core/clients/temporal/temporal_client.py +34 -34
- agentex/lib/core/clients/temporal/types.py +1 -1
- agentex/lib/core/clients/temporal/utils.py +9 -12
- agentex/lib/core/services/adk/acp/acp.py +6 -6
- agentex/lib/core/services/adk/agent_task_tracker.py +1 -1
- agentex/lib/core/services/adk/agents.py +1 -1
- agentex/lib/core/services/adk/events.py +1 -1
- agentex/lib/core/services/adk/messages.py +5 -6
- agentex/lib/core/services/adk/providers/litellm.py +10 -10
- agentex/lib/core/services/adk/providers/openai.py +75 -43
- agentex/lib/core/services/adk/providers/sgp.py +3 -3
- agentex/lib/core/services/adk/state.py +5 -1
- agentex/lib/core/services/adk/streaming.py +19 -19
- agentex/lib/core/services/adk/tasks.py +8 -2
- agentex/lib/core/services/adk/tracing.py +3 -2
- agentex/lib/core/services/adk/utils/templating.py +4 -2
- agentex/lib/core/temporal/activities/__init__.py +27 -27
- agentex/lib/core/temporal/activities/activity_helpers.py +1 -1
- agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +4 -4
- agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +1 -1
- agentex/lib/core/temporal/activities/adk/agents_activities.py +2 -2
- agentex/lib/core/temporal/activities/adk/events_activities.py +1 -1
- agentex/lib/core/temporal/activities/adk/messages_activities.py +3 -3
- agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +4 -4
- agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +1 -1
- agentex/lib/core/temporal/activities/adk/state_activities.py +1 -1
- agentex/lib/core/temporal/activities/adk/streaming_activities.py +3 -3
- agentex/lib/core/temporal/activities/adk/tasks_activities.py +2 -2
- agentex/lib/core/temporal/activities/adk/tracing_activities.py +1 -1
- agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +1 -1
- agentex/lib/core/temporal/services/temporal_task_service.py +7 -7
- agentex/lib/core/temporal/workers/worker.py +31 -40
- agentex/lib/core/temporal/workflows/workflow.py +2 -2
- agentex/lib/core/tracing/__init__.py +2 -2
- agentex/lib/core/tracing/processors/agentex_tracing_processor.py +6 -6
- agentex/lib/core/tracing/processors/sgp_tracing_processor.py +16 -16
- agentex/lib/core/tracing/processors/tracing_processor_interface.py +1 -1
- agentex/lib/core/tracing/trace.py +7 -7
- agentex/lib/core/tracing/tracer.py +2 -2
- agentex/lib/core/tracing/tracing_processor_manager.py +43 -13
- agentex/lib/environment_variables.py +4 -4
- agentex/lib/sdk/config/agent_config.py +2 -2
- agentex/lib/sdk/config/agent_manifest.py +8 -8
- agentex/lib/sdk/config/project_config.py +6 -6
- agentex/lib/sdk/config/validation.py +2 -2
- agentex/lib/sdk/fastacp/base/base_acp_server.py +16 -16
- agentex/lib/sdk/fastacp/fastacp.py +14 -15
- agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +4 -5
- agentex/lib/sdk/fastacp/impl/sync_acp.py +7 -7
- agentex/lib/sdk/fastacp/impl/temporal_acp.py +28 -19
- agentex/lib/sdk/fastacp/tests/conftest.py +18 -16
- agentex/lib/sdk/fastacp/tests/run_tests.py +1 -1
- agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +4 -4
- agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +8 -8
- agentex/lib/sdk/fastacp/tests/test_integration.py +15 -14
- agentex/lib/sdk/state_machine/__init__.py +1 -1
- agentex/lib/sdk/state_machine/noop_workflow.py +5 -3
- agentex/lib/sdk/state_machine/state_machine.py +18 -12
- agentex/lib/sdk/utils/messages.py +5 -5
- agentex/lib/types/acp.py +2 -2
- agentex/lib/types/agent_configs.py +1 -1
- agentex/lib/types/converters.py +4 -2
- agentex/lib/types/credentials.py +1 -1
- agentex/lib/types/fastacp.py +4 -5
- agentex/lib/types/tracing.py +1 -1
- agentex/lib/utils/completions.py +5 -5
- agentex/lib/utils/console.py +1 -1
- agentex/lib/utils/debug.py +10 -5
- agentex/lib/utils/dev_tools/async_messages.py +11 -12
- agentex/lib/utils/iterables.py +1 -1
- agentex/lib/utils/json_schema.py +4 -4
- agentex/lib/utils/logging.py +7 -7
- agentex/lib/utils/mcp.py +1 -0
- agentex/lib/utils/model_utils.py +4 -5
- agentex/lib/utils/registration.py +5 -4
- agentex/resources/agents.py +11 -4
- agentex/types/agent_rpc_response.py +3 -3
- agentex/types/data_content.py +1 -1
- agentex/types/tool_request_content.py +1 -1
- agentex/types/tool_response_content.py +0 -1
- {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.20.dist-info}/METADATA +1 -1
- {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.20.dist-info}/RECORD +129 -129
- {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.20.dist-info}/WHEEL +0 -0
- {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.20.dist-info}/entry_points.txt +0 -0
- {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.20.dist-info}/licenses/LICENSE +0 -0
agentex/__init__.py
CHANGED
agentex/_utils/_typing.py
CHANGED
@@ -53,7 +53,9 @@ def is_typevar(typ: type) -> bool:
|
|
53
53
|
|
54
54
|
_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,)
|
55
55
|
if sys.version_info >= (3, 12):
|
56
|
-
|
56
|
+
# NOTE: This type ignore will be overwritten by Stainless generator.
|
57
|
+
# TODO: Update Stainless config to include this type ignore or move to lib/
|
58
|
+
_TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) # type: ignore[assignment]
|
57
59
|
|
58
60
|
|
59
61
|
def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
|
agentex/_version.py
CHANGED
agentex/lib/adk/__init__.py
CHANGED
agentex/lib/adk/_modules/acp.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
from typing import Any, List
|
3
5
|
|
4
6
|
from agentex.types import Event
|
5
7
|
from temporalio.common import RetryPolicy
|
6
8
|
|
7
|
-
from agentex import AsyncAgentex
|
9
|
+
from agentex import AsyncAgentex # noqa: F401
|
8
10
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
9
11
|
from agentex.lib.core.services.adk.acp.acp import ACPService
|
10
12
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
|
3
5
|
from temporalio.common import RetryPolicy
|
4
6
|
|
5
|
-
from agentex import AsyncAgentex
|
7
|
+
from agentex import AsyncAgentex # noqa: F401
|
6
8
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
7
9
|
from agentex.lib.core.services.adk.agent_task_tracker import AgentTaskTrackerService
|
8
10
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
from typing import Optional
|
3
5
|
|
@@ -5,7 +7,7 @@ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
|
5
7
|
from agentex.lib.core.temporal.activities.adk.agents_activities import AgentsActivityName, GetAgentParams
|
6
8
|
from temporalio.common import RetryPolicy
|
7
9
|
|
8
|
-
from agentex import AsyncAgentex
|
10
|
+
from agentex import AsyncAgentex # noqa: F401
|
9
11
|
from agentex.lib.core.services.adk.agents import AgentsService
|
10
12
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
11
13
|
from agentex.lib.core.tracing.tracer import AsyncTracer
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
|
3
5
|
from temporalio.common import RetryPolicy
|
4
6
|
|
5
|
-
from agentex import AsyncAgentex
|
7
|
+
from agentex import AsyncAgentex # noqa: F401
|
6
8
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
7
9
|
from agentex.lib.core.services.adk.events import EventsService
|
8
10
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
|
3
5
|
from temporalio.common import RetryPolicy
|
4
6
|
|
5
|
-
from agentex import AsyncAgentex
|
7
|
+
from agentex import AsyncAgentex # noqa: F401
|
6
8
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
7
9
|
from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
|
8
10
|
from agentex.lib.core.services.adk.messages import MessagesService
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
from typing import Any
|
3
5
|
|
4
6
|
from pydantic import BaseModel
|
5
7
|
from temporalio.common import RetryPolicy
|
6
8
|
|
7
|
-
from agentex import AsyncAgentex
|
9
|
+
from agentex import AsyncAgentex # noqa: F401
|
8
10
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
9
11
|
from agentex.lib.core.services.adk.state import StateService
|
10
12
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from temporalio.common import RetryPolicy
|
2
4
|
|
3
|
-
from agentex import AsyncAgentex
|
5
|
+
from agentex import AsyncAgentex # noqa: F401
|
4
6
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
5
7
|
from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
|
6
8
|
from agentex.lib.core.services.adk.streaming import (
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from datetime import timedelta
|
2
4
|
|
3
5
|
from temporalio.common import RetryPolicy
|
4
6
|
|
5
|
-
from agentex import AsyncAgentex
|
7
|
+
from agentex import AsyncAgentex # noqa: F401
|
6
8
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
7
9
|
from agentex.lib.core.services.adk.tasks import TasksService
|
8
10
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -117,7 +119,7 @@ class TasksModule:
|
|
117
119
|
heartbeat_timeout=heartbeat_timeout,
|
118
120
|
)
|
119
121
|
else:
|
120
|
-
return await self._tasks_service.delete_task(
|
122
|
+
return await self._tasks_service.delete_task( # type: ignore[return-value]
|
121
123
|
task_id=task_id,
|
122
124
|
task_name=task_name,
|
123
125
|
trace_id=trace_id,
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
# Import order matters - AsyncTracer must come after client import to avoid circular imports
|
1
3
|
from collections.abc import AsyncGenerator
|
2
4
|
from contextlib import asynccontextmanager
|
3
5
|
from datetime import timedelta
|
@@ -5,7 +7,7 @@ from typing import Any
|
|
5
7
|
|
6
8
|
from temporalio.common import RetryPolicy
|
7
9
|
|
8
|
-
from agentex import AsyncAgentex
|
10
|
+
from agentex import AsyncAgentex # noqa: F401
|
9
11
|
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
10
12
|
from agentex.lib.core.services.adk.tracing import TracingService
|
11
13
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
@@ -1,6 +1,6 @@
|
|
1
|
-
from agentex.lib.adk.providers._modules.litellm import LiteLLMModule
|
2
|
-
from agentex.lib.adk.providers._modules.openai import OpenAIModule
|
3
1
|
from agentex.lib.adk.providers._modules.sgp import SGPModule
|
2
|
+
from agentex.lib.adk.providers._modules.openai import OpenAIModule
|
3
|
+
from agentex.lib.adk.providers._modules.litellm import LiteLLMModule
|
4
4
|
|
5
5
|
openai = OpenAIModule()
|
6
6
|
litellm = LiteLLMModule()
|
@@ -1,26 +1,25 @@
|
|
1
|
-
from collections.abc import AsyncGenerator
|
2
1
|
from datetime import timedelta
|
2
|
+
from collections.abc import AsyncGenerator
|
3
3
|
|
4
|
-
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
5
4
|
from temporalio.common import RetryPolicy
|
6
5
|
|
7
|
-
from agentex import
|
6
|
+
from agentex.lib.utils.logging import make_logger
|
7
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
8
|
+
from agentex.types.task_message import TaskMessage
|
9
|
+
from agentex.lib.types.llm_messages import LLMConfig, Completion
|
10
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
11
|
+
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
12
|
+
from agentex.lib.core.services.adk.streaming import StreamingService
|
8
13
|
from agentex.lib.core.adapters.llm.adapter_litellm import LiteLLMGateway
|
9
14
|
from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
|
10
15
|
from agentex.lib.core.services.adk.providers.litellm import LiteLLMService
|
11
|
-
from agentex.lib.core.services.adk.streaming import StreamingService
|
12
16
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
13
17
|
from agentex.lib.core.temporal.activities.adk.providers.litellm_activities import (
|
14
|
-
|
18
|
+
LiteLLMActivityName,
|
15
19
|
ChatCompletionParams,
|
20
|
+
ChatCompletionAutoSendParams,
|
16
21
|
ChatCompletionStreamAutoSendParams,
|
17
|
-
LiteLLMActivityName,
|
18
22
|
)
|
19
|
-
from agentex.lib.core.tracing.tracer import AsyncTracer
|
20
|
-
from agentex.lib.types.llm_messages import Completion, LLMConfig
|
21
|
-
from agentex.types.task_message import TaskMessage
|
22
|
-
from agentex.lib.utils.logging import make_logger
|
23
|
-
from agentex.lib.utils.temporal import in_temporal_workflow
|
24
23
|
|
25
24
|
logger = make_logger(__name__)
|
26
25
|
|
@@ -1,34 +1,33 @@
|
|
1
|
-
from datetime import timedelta
|
2
1
|
from typing import Any, Literal
|
2
|
+
from datetime import timedelta
|
3
3
|
|
4
|
-
from
|
4
|
+
from mcp import StdioServerParameters
|
5
5
|
from agents import Agent, RunResult, RunResultStreaming
|
6
|
+
from agents.tool import Tool
|
6
7
|
from agents.agent import StopAtTools, ToolsToFinalOutputFunction
|
7
8
|
from agents.guardrail import InputGuardrail, OutputGuardrail
|
9
|
+
from temporalio.common import RetryPolicy
|
8
10
|
from agents.agent_output import AgentOutputSchemaBase
|
9
11
|
from agents.model_settings import ModelSettings
|
10
|
-
from agents.tool import Tool
|
11
|
-
from mcp import StdioServerParameters
|
12
|
-
from temporalio.common import RetryPolicy
|
13
12
|
|
14
|
-
from agentex import
|
15
|
-
from agentex.lib.
|
16
|
-
from agentex.lib.core.
|
13
|
+
from agentex.lib.utils.logging import make_logger
|
14
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
15
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
16
|
+
from agentex.lib.types.agent_results import (
|
17
|
+
SerializableRunResult,
|
18
|
+
SerializableRunResultStreaming,
|
19
|
+
)
|
20
|
+
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
17
21
|
from agentex.lib.core.services.adk.streaming import StreamingService
|
22
|
+
from agentex.lib.core.services.adk.providers.openai import OpenAIService
|
23
|
+
from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
|
18
24
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
19
25
|
from agentex.lib.core.temporal.activities.adk.providers.openai_activities import (
|
26
|
+
RunAgentParams,
|
20
27
|
OpenAIActivityName,
|
21
28
|
RunAgentAutoSendParams,
|
22
|
-
RunAgentParams,
|
23
29
|
RunAgentStreamedAutoSendParams,
|
24
30
|
)
|
25
|
-
from agentex.lib.core.tracing.tracer import AsyncTracer
|
26
|
-
from agentex.lib.types.agent_results import (
|
27
|
-
SerializableRunResult,
|
28
|
-
SerializableRunResultStreaming,
|
29
|
-
)
|
30
|
-
from agentex.lib.utils.logging import make_logger
|
31
|
-
from agentex.lib.utils.temporal import in_temporal_workflow
|
32
31
|
|
33
32
|
logger = make_logger(__name__)
|
34
33
|
|
@@ -129,15 +128,15 @@ class OpenAIModule:
|
|
129
128
|
agent_name=agent_name,
|
130
129
|
agent_instructions=agent_instructions,
|
131
130
|
handoff_description=handoff_description,
|
132
|
-
handoffs=handoffs,
|
131
|
+
handoffs=handoffs, # type: ignore[arg-type]
|
133
132
|
model=model,
|
134
|
-
model_settings=model_settings,
|
135
|
-
tools=tools,
|
133
|
+
model_settings=model_settings, # type: ignore[arg-type]
|
134
|
+
tools=tools, # type: ignore[arg-type]
|
136
135
|
output_type=output_type,
|
137
|
-
tool_use_behavior=tool_use_behavior,
|
136
|
+
tool_use_behavior=tool_use_behavior, # type: ignore[arg-type]
|
138
137
|
mcp_timeout_seconds=mcp_timeout_seconds,
|
139
|
-
input_guardrails=input_guardrails,
|
140
|
-
output_guardrails=output_guardrails,
|
138
|
+
input_guardrails=input_guardrails, # type: ignore[arg-type]
|
139
|
+
output_guardrails=output_guardrails, # type: ignore[arg-type]
|
141
140
|
max_turns=max_turns,
|
142
141
|
previous_response_id=previous_response_id,
|
143
142
|
)
|
@@ -238,15 +237,15 @@ class OpenAIModule:
|
|
238
237
|
agent_name=agent_name,
|
239
238
|
agent_instructions=agent_instructions,
|
240
239
|
handoff_description=handoff_description,
|
241
|
-
handoffs=handoffs,
|
240
|
+
handoffs=handoffs, # type: ignore[arg-type]
|
242
241
|
model=model,
|
243
|
-
model_settings=model_settings,
|
244
|
-
tools=tools,
|
242
|
+
model_settings=model_settings, # type: ignore[arg-type]
|
243
|
+
tools=tools, # type: ignore[arg-type]
|
245
244
|
output_type=output_type,
|
246
|
-
tool_use_behavior=tool_use_behavior,
|
245
|
+
tool_use_behavior=tool_use_behavior, # type: ignore[arg-type]
|
247
246
|
mcp_timeout_seconds=mcp_timeout_seconds,
|
248
|
-
input_guardrails=input_guardrails,
|
249
|
-
output_guardrails=output_guardrails,
|
247
|
+
input_guardrails=input_guardrails, # type: ignore[arg-type]
|
248
|
+
output_guardrails=output_guardrails, # type: ignore[arg-type]
|
250
249
|
max_turns=max_turns,
|
251
250
|
previous_response_id=previous_response_id,
|
252
251
|
)
|
@@ -1,20 +1,19 @@
|
|
1
1
|
from datetime import timedelta
|
2
2
|
|
3
|
-
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
4
3
|
from scale_gp import SGPClient, SGPClientError
|
5
4
|
from temporalio.common import RetryPolicy
|
6
5
|
|
7
|
-
from agentex import
|
6
|
+
from agentex.lib.utils.logging import make_logger
|
7
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
8
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
9
|
+
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
8
10
|
from agentex.lib.core.services.adk.providers.sgp import SGPService
|
9
11
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
10
12
|
from agentex.lib.core.temporal.activities.adk.providers.sgp_activities import (
|
13
|
+
SGPActivityName,
|
11
14
|
DownloadFileParams,
|
12
15
|
FileContentResponse,
|
13
|
-
SGPActivityName,
|
14
16
|
)
|
15
|
-
from agentex.lib.core.tracing.tracer import AsyncTracer
|
16
|
-
from agentex.lib.utils.logging import make_logger
|
17
|
-
from agentex.lib.utils.temporal import in_temporal_workflow
|
18
17
|
|
19
18
|
logger = make_logger(__name__)
|
20
19
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
from typing import override
|
2
|
+
|
1
3
|
import httpx
|
2
4
|
|
3
5
|
from agentex import AsyncAgentex
|
4
|
-
from agentex.lib.environment_variables import EnvironmentVariables
|
5
6
|
from agentex.lib.utils.logging import make_logger
|
7
|
+
from agentex.lib.environment_variables import EnvironmentVariables
|
6
8
|
|
7
9
|
logger = make_logger(__name__)
|
8
10
|
|
@@ -11,6 +13,7 @@ class EnvAuth(httpx.Auth):
|
|
11
13
|
def __init__(self, header_name="x-agent-api-key"):
|
12
14
|
self.header_name = header_name
|
13
15
|
|
16
|
+
@override
|
14
17
|
def auth_flow(self, request):
|
15
18
|
# This gets called for every request
|
16
19
|
env_vars = EnvironmentVariables.refresh()
|
@@ -1,19 +1,18 @@
|
|
1
|
-
from datetime import timedelta
|
2
1
|
from typing import Any
|
2
|
+
from datetime import timedelta
|
3
3
|
|
4
|
-
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
5
4
|
from temporalio.common import RetryPolicy
|
6
5
|
|
7
|
-
from agentex import
|
6
|
+
from agentex.lib.utils.logging import make_logger
|
7
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
8
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
9
|
+
from agentex.lib.adk.utils._modules.client import create_async_agentex_client
|
8
10
|
from agentex.lib.core.services.adk.utils.templating import TemplatingService
|
9
11
|
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
10
12
|
from agentex.lib.core.temporal.activities.adk.utils.templating_activities import (
|
11
13
|
JinjaActivityName,
|
12
14
|
RenderJinjaParams,
|
13
15
|
)
|
14
|
-
from agentex.lib.core.tracing.tracer import AsyncTracer
|
15
|
-
from agentex.lib.utils.logging import make_logger
|
16
|
-
from agentex.lib.utils.temporal import in_temporal_workflow
|
17
16
|
|
18
17
|
logger = make_logger(__name__)
|
19
18
|
|
@@ -1,37 +1,37 @@
|
|
1
1
|
import builtins
|
2
2
|
from pathlib import Path
|
3
3
|
|
4
|
-
import questionary
|
5
4
|
import typer
|
5
|
+
import questionary
|
6
6
|
from rich import print_json
|
7
|
-
from rich.console import Console
|
8
7
|
from rich.panel import Panel
|
8
|
+
from rich.console import Console
|
9
9
|
|
10
|
+
from agentex import Agentex
|
11
|
+
from agentex.lib.cli.debug import DebugMode, DebugConfig
|
12
|
+
from agentex.lib.utils.logging import make_logger
|
13
|
+
from agentex.lib.cli.utils.cli_utils import handle_questionary_cancellation
|
14
|
+
from agentex.lib.sdk.config.validation import (
|
15
|
+
EnvironmentsValidationError,
|
16
|
+
generate_helpful_error_message,
|
17
|
+
validate_manifest_and_environments,
|
18
|
+
)
|
19
|
+
from agentex.lib.cli.utils.kubectl_utils import (
|
20
|
+
validate_namespace,
|
21
|
+
check_and_switch_cluster_context,
|
22
|
+
)
|
23
|
+
from agentex.lib.sdk.config.agent_manifest import AgentManifest
|
10
24
|
from agentex.lib.cli.handlers.agent_handlers import (
|
11
|
-
build_agent,
|
12
25
|
run_agent,
|
26
|
+
build_agent,
|
13
27
|
)
|
14
|
-
from agentex.lib.cli.debug import DebugConfig, DebugMode
|
15
|
-
from agentex.lib.cli.handlers.cleanup_handlers import cleanup_agent_workflows
|
16
28
|
from agentex.lib.cli.handlers.deploy_handlers import (
|
17
|
-
DeploymentError,
|
18
29
|
HelmError,
|
30
|
+
DeploymentError,
|
19
31
|
InputDeployOverrides,
|
20
32
|
deploy_agent,
|
21
33
|
)
|
22
|
-
from agentex.lib.
|
23
|
-
validate_manifest_and_environments,
|
24
|
-
EnvironmentsValidationError,
|
25
|
-
generate_helpful_error_message
|
26
|
-
)
|
27
|
-
from agentex.lib.cli.utils.cli_utils import handle_questionary_cancellation
|
28
|
-
from agentex.lib.cli.utils.kubectl_utils import (
|
29
|
-
check_and_switch_cluster_context,
|
30
|
-
validate_namespace,
|
31
|
-
)
|
32
|
-
from agentex import Agentex
|
33
|
-
from agentex.lib.sdk.config.agent_manifest import AgentManifest
|
34
|
-
from agentex.lib.utils.logging import make_logger
|
34
|
+
from agentex.lib.cli.handlers.cleanup_handlers import cleanup_agent_workflows
|
35
35
|
|
36
36
|
logger = make_logger(__name__)
|
37
37
|
console = Console()
|
@@ -293,10 +293,10 @@ def deploy(
|
|
293
293
|
except EnvironmentsValidationError as e:
|
294
294
|
error_msg = generate_helpful_error_message(e, "Environment validation failed")
|
295
295
|
console.print(f"[red]Configuration Error:[/red]\n{error_msg}")
|
296
|
-
raise typer.Exit(1)
|
296
|
+
raise typer.Exit(1) from e
|
297
297
|
except Exception as e:
|
298
298
|
console.print(f"[red]Error:[/red] Failed to validate configuration: {e}")
|
299
|
-
raise typer.Exit(1)
|
299
|
+
raise typer.Exit(1) from e
|
300
300
|
|
301
301
|
# Load manifest for credential validation
|
302
302
|
manifest_obj = AgentManifest.from_yaml(str(manifest_path))
|
agentex/lib/cli/commands/init.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
from enum import Enum
|
2
|
-
from pathlib import Path
|
3
2
|
from typing import Any, Dict
|
3
|
+
from pathlib import Path
|
4
4
|
|
5
5
|
import questionary
|
6
6
|
from jinja2 import Environment, FileSystemLoader
|
7
|
-
from rich.console import Console
|
8
7
|
from rich.panel import Panel
|
9
8
|
from rich.table import Table
|
9
|
+
from rich.console import Console
|
10
10
|
|
11
11
|
from agentex.lib.utils.logging import make_logger
|
12
12
|
|
@@ -86,7 +86,7 @@ def create_project_structure(
|
|
86
86
|
console.print(f"\n[green]✓[/green] Created project structure at: {project_dir}")
|
87
87
|
|
88
88
|
|
89
|
-
def get_project_context(answers: Dict[str, Any], project_path: Path, manifest_root: Path) -> Dict[str, Any]:
|
89
|
+
def get_project_context(answers: Dict[str, Any], project_path: Path, manifest_root: Path) -> Dict[str, Any]: # noqa: ARG001
|
90
90
|
"""Get the project context from user answers"""
|
91
91
|
# Use agent_directory_name as project_name
|
92
92
|
project_name = answers["agent_directory_name"].replace("-", "_")
|
agentex/lib/cli/commands/main.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import typer
|
2
2
|
|
3
|
-
from agentex.lib.cli.commands.
|
3
|
+
from agentex.lib.cli.commands.uv import uv
|
4
4
|
from agentex.lib.cli.commands.init import init
|
5
|
-
from agentex.lib.cli.commands.secrets import secrets
|
6
5
|
from agentex.lib.cli.commands.tasks import tasks
|
7
|
-
from agentex.lib.cli.commands.
|
6
|
+
from agentex.lib.cli.commands.agents import agents
|
7
|
+
from agentex.lib.cli.commands.secrets import secrets
|
8
8
|
|
9
9
|
# Create the main Typer application
|
10
10
|
app = typer.Typer(
|
@@ -1,24 +1,24 @@
|
|
1
1
|
from pathlib import Path
|
2
2
|
|
3
|
-
import questionary
|
4
3
|
import typer
|
4
|
+
import questionary
|
5
5
|
from rich import print_json
|
6
|
-
from rich.console import Console
|
7
6
|
from rich.panel import Panel
|
7
|
+
from rich.console import Console
|
8
8
|
|
9
|
-
from agentex.lib.
|
10
|
-
delete_secret,
|
11
|
-
get_kubernetes_secrets_by_type,
|
12
|
-
get_secret,
|
13
|
-
sync_secrets,
|
14
|
-
)
|
9
|
+
from agentex.lib.utils.logging import make_logger
|
15
10
|
from agentex.lib.cli.utils.cli_utils import handle_questionary_cancellation
|
16
11
|
from agentex.lib.cli.utils.kubectl_utils import (
|
17
|
-
check_and_switch_cluster_context,
|
18
12
|
validate_namespace,
|
13
|
+
check_and_switch_cluster_context,
|
19
14
|
)
|
20
15
|
from agentex.lib.sdk.config.agent_manifest import AgentManifest
|
21
|
-
from agentex.lib.
|
16
|
+
from agentex.lib.cli.handlers.secret_handlers import (
|
17
|
+
get_secret,
|
18
|
+
sync_secrets,
|
19
|
+
delete_secret,
|
20
|
+
get_kubernetes_secrets_by_type,
|
21
|
+
)
|
22
22
|
|
23
23
|
logger = make_logger(__name__)
|
24
24
|
console = Console()
|
@@ -1,10 +1,12 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
1
3
|
import typer
|
2
4
|
from rich import print_json
|
3
5
|
from rich.console import Console
|
4
6
|
|
5
7
|
from agentex import Agentex
|
6
|
-
from agentex.lib.cli.handlers.cleanup_handlers import cleanup_agent_workflows
|
7
8
|
from agentex.lib.utils.logging import make_logger
|
9
|
+
from agentex.lib.cli.handlers.cleanup_handlers import cleanup_agent_workflows
|
8
10
|
|
9
11
|
logger = make_logger(__name__)
|
10
12
|
console = Console()
|
@@ -22,7 +24,7 @@ def get(
|
|
22
24
|
logger.info(f"Getting task: {task_id}")
|
23
25
|
client = Agentex()
|
24
26
|
task = client.tasks.retrieve(task_id=task_id)
|
25
|
-
|
27
|
+
logger.info(f"Full Task {task_id}:")
|
26
28
|
print_json(data=task.to_dict())
|
27
29
|
|
28
30
|
|
@@ -45,35 +47,33 @@ def list_running(
|
|
45
47
|
"""
|
46
48
|
client = Agentex()
|
47
49
|
all_tasks = client.tasks.list()
|
48
|
-
running_tasks = [task for task in all_tasks if hasattr(task,
|
49
|
-
|
50
|
+
running_tasks = [task for task in all_tasks if hasattr(task, "status") and task.status == "RUNNING"]
|
51
|
+
|
50
52
|
if not running_tasks:
|
51
53
|
console.print(f"[yellow]No running tasks found for agent '{agent_name}'[/yellow]")
|
52
54
|
return
|
53
|
-
|
55
|
+
|
54
56
|
console.print(f"[green]Found {len(running_tasks)} running task(s) for agent '{agent_name}':[/green]")
|
55
|
-
|
57
|
+
|
56
58
|
# Convert to dict with proper datetime serialization
|
57
|
-
serializable_tasks = []
|
59
|
+
serializable_tasks: list[dict[str, Any]] = [] # type: ignore[misc]
|
58
60
|
for task in running_tasks:
|
59
61
|
try:
|
60
62
|
# Use model_dump with mode='json' for proper datetime handling
|
61
|
-
if hasattr(task,
|
62
|
-
serializable_tasks.append(task.model_dump(mode=
|
63
|
+
if hasattr(task, "model_dump"):
|
64
|
+
serializable_tasks.append(task.model_dump(mode="json"))
|
63
65
|
else:
|
64
66
|
# Fallback for non-Pydantic objects
|
65
|
-
serializable_tasks.append(
|
66
|
-
"id": getattr(task,
|
67
|
-
|
68
|
-
})
|
67
|
+
serializable_tasks.append(
|
68
|
+
{"id": getattr(task, "id", "unknown"), "status": getattr(task, "status", "unknown")}
|
69
|
+
)
|
69
70
|
except Exception as e:
|
70
71
|
logger.warning(f"Failed to serialize task: {e}")
|
71
72
|
# Minimal fallback
|
72
|
-
serializable_tasks.append(
|
73
|
-
"id": getattr(task,
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
serializable_tasks.append(
|
74
|
+
{"id": getattr(task, "id", "unknown"), "status": getattr(task, "status", "unknown")}
|
75
|
+
)
|
76
|
+
|
77
77
|
print_json(data=serializable_tasks)
|
78
78
|
|
79
79
|
|
@@ -93,25 +93,23 @@ def delete(
|
|
93
93
|
@tasks.command()
|
94
94
|
def cleanup(
|
95
95
|
agent_name: str = typer.Option(..., help="Name of the agent to cleanup tasks for"),
|
96
|
-
force: bool = typer.Option(
|
96
|
+
force: bool = typer.Option(
|
97
|
+
False, help="Force cleanup using direct Temporal termination (bypasses development check)"
|
98
|
+
),
|
97
99
|
):
|
98
100
|
"""
|
99
101
|
Clean up all running tasks/workflows for an agent.
|
100
|
-
|
102
|
+
|
101
103
|
By default, uses graceful cancellation via agent RPC.
|
102
104
|
With --force, directly terminates workflows via Temporal client.
|
103
105
|
"""
|
104
106
|
try:
|
105
107
|
console.print(f"[blue]Starting cleanup for agent '{agent_name}'...[/blue]")
|
106
|
-
|
107
|
-
cleanup_agent_workflows(
|
108
|
-
|
109
|
-
force=force,
|
110
|
-
development_only=True
|
111
|
-
)
|
112
|
-
|
108
|
+
|
109
|
+
cleanup_agent_workflows(agent_name=agent_name, force=force, development_only=True)
|
110
|
+
|
113
111
|
console.print(f"[green]✓ Cleanup completed for agent '{agent_name}'[/green]")
|
114
|
-
|
112
|
+
|
115
113
|
except Exception as e:
|
116
114
|
console.print(f"[red]Cleanup failed: {str(e)}[/red]")
|
117
115
|
logger.exception("Task cleanup failed")
|
agentex/lib/cli/commands/uv.py
CHANGED
@@ -4,7 +4,7 @@ Debug functionality for AgentEx CLI
|
|
4
4
|
Provides debug support for temporal workers and ACP servers during local development.
|
5
5
|
"""
|
6
6
|
|
7
|
-
from .debug_config import
|
7
|
+
from .debug_config import DebugMode, DebugConfig
|
8
8
|
from .debug_handlers import start_acp_server_debug, start_temporal_worker_debug
|
9
9
|
|
10
10
|
__all__ = [
|