agentex-sdk 0.1.0a6__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 +103 -0
- agentex/_base_client.py +1992 -0
- agentex/_client.py +506 -0
- agentex/_compat.py +219 -0
- agentex/_constants.py +14 -0
- agentex/_exceptions.py +108 -0
- agentex/_files.py +123 -0
- agentex/_models.py +829 -0
- agentex/_qs.py +150 -0
- agentex/_resource.py +43 -0
- agentex/_response.py +830 -0
- agentex/_streaming.py +333 -0
- agentex/_types.py +219 -0
- agentex/_utils/__init__.py +57 -0
- agentex/_utils/_logs.py +25 -0
- agentex/_utils/_proxy.py +65 -0
- agentex/_utils/_reflection.py +42 -0
- agentex/_utils/_resources_proxy.py +24 -0
- agentex/_utils/_streams.py +12 -0
- agentex/_utils/_sync.py +86 -0
- agentex/_utils/_transform.py +447 -0
- agentex/_utils/_typing.py +151 -0
- agentex/_utils/_utils.py +422 -0
- agentex/_version.py +4 -0
- agentex/lib/.keep +4 -0
- agentex/lib/__init__.py +0 -0
- agentex/lib/adk/__init__.py +41 -0
- agentex/lib/adk/_modules/__init__.py +0 -0
- agentex/lib/adk/_modules/acp.py +247 -0
- agentex/lib/adk/_modules/agent_task_tracker.py +176 -0
- agentex/lib/adk/_modules/agents.py +77 -0
- agentex/lib/adk/_modules/events.py +141 -0
- agentex/lib/adk/_modules/messages.py +285 -0
- agentex/lib/adk/_modules/state.py +291 -0
- agentex/lib/adk/_modules/streaming.py +75 -0
- agentex/lib/adk/_modules/tasks.py +124 -0
- agentex/lib/adk/_modules/tracing.py +194 -0
- agentex/lib/adk/providers/__init__.py +9 -0
- agentex/lib/adk/providers/_modules/__init__.py +0 -0
- agentex/lib/adk/providers/_modules/litellm.py +232 -0
- agentex/lib/adk/providers/_modules/openai.py +416 -0
- agentex/lib/adk/providers/_modules/sgp.py +85 -0
- agentex/lib/adk/utils/__init__.py +5 -0
- agentex/lib/adk/utils/_modules/__init__.py +0 -0
- agentex/lib/adk/utils/_modules/templating.py +94 -0
- agentex/lib/cli/__init__.py +0 -0
- agentex/lib/cli/commands/__init__.py +0 -0
- agentex/lib/cli/commands/agents.py +328 -0
- agentex/lib/cli/commands/init.py +227 -0
- agentex/lib/cli/commands/main.py +33 -0
- agentex/lib/cli/commands/secrets.py +169 -0
- agentex/lib/cli/commands/tasks.py +118 -0
- agentex/lib/cli/commands/uv.py +133 -0
- agentex/lib/cli/handlers/__init__.py +0 -0
- agentex/lib/cli/handlers/agent_handlers.py +160 -0
- agentex/lib/cli/handlers/cleanup_handlers.py +186 -0
- agentex/lib/cli/handlers/deploy_handlers.py +351 -0
- agentex/lib/cli/handlers/run_handlers.py +452 -0
- agentex/lib/cli/handlers/secret_handlers.py +670 -0
- agentex/lib/cli/templates/default/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/default/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/default/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/default/README.md.j2 +193 -0
- agentex/lib/cli/templates/default/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/default/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/default/project/acp.py.j2 +29 -0
- agentex/lib/cli/templates/default/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/default/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/deploy/Screenshot 2025-03-19 at 10.36.57/342/200/257AM.png +0 -0
- agentex/lib/cli/templates/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/sync/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/sync/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/sync/README.md.j2 +293 -0
- agentex/lib/cli/templates/sync/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/sync/project/acp.py.j2 +26 -0
- agentex/lib/cli/templates/sync/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/sync/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/temporal/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/temporal/Dockerfile-uv.j2 +48 -0
- agentex/lib/cli/templates/temporal/Dockerfile.j2 +48 -0
- agentex/lib/cli/templates/temporal/README.md.j2 +316 -0
- agentex/lib/cli/templates/temporal/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/temporal/manifest.yaml.j2 +137 -0
- agentex/lib/cli/templates/temporal/project/acp.py.j2 +30 -0
- agentex/lib/cli/templates/temporal/project/run_worker.py.j2 +33 -0
- agentex/lib/cli/templates/temporal/project/workflow.py.j2 +66 -0
- agentex/lib/cli/templates/temporal/pyproject.toml.j2 +34 -0
- agentex/lib/cli/templates/temporal/requirements.txt.j2 +5 -0
- agentex/lib/cli/utils/cli_utils.py +14 -0
- agentex/lib/cli/utils/credential_utils.py +103 -0
- agentex/lib/cli/utils/exceptions.py +6 -0
- agentex/lib/cli/utils/kubectl_utils.py +135 -0
- agentex/lib/cli/utils/kubernetes_secrets_utils.py +185 -0
- agentex/lib/core/__init__.py +0 -0
- agentex/lib/core/adapters/__init__.py +0 -0
- agentex/lib/core/adapters/llm/__init__.py +1 -0
- agentex/lib/core/adapters/llm/adapter_litellm.py +46 -0
- agentex/lib/core/adapters/llm/adapter_sgp.py +55 -0
- agentex/lib/core/adapters/llm/port.py +24 -0
- agentex/lib/core/adapters/streams/adapter_redis.py +128 -0
- agentex/lib/core/adapters/streams/port.py +50 -0
- agentex/lib/core/clients/__init__.py +1 -0
- agentex/lib/core/clients/temporal/__init__.py +0 -0
- agentex/lib/core/clients/temporal/temporal_client.py +181 -0
- agentex/lib/core/clients/temporal/types.py +47 -0
- agentex/lib/core/clients/temporal/utils.py +56 -0
- agentex/lib/core/services/__init__.py +0 -0
- agentex/lib/core/services/adk/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/acp.py +210 -0
- agentex/lib/core/services/adk/agent_task_tracker.py +85 -0
- agentex/lib/core/services/adk/agents.py +43 -0
- agentex/lib/core/services/adk/events.py +61 -0
- agentex/lib/core/services/adk/messages.py +164 -0
- agentex/lib/core/services/adk/providers/__init__.py +0 -0
- agentex/lib/core/services/adk/providers/litellm.py +256 -0
- agentex/lib/core/services/adk/providers/openai.py +723 -0
- agentex/lib/core/services/adk/providers/sgp.py +99 -0
- agentex/lib/core/services/adk/state.py +120 -0
- agentex/lib/core/services/adk/streaming.py +262 -0
- agentex/lib/core/services/adk/tasks.py +69 -0
- agentex/lib/core/services/adk/tracing.py +36 -0
- agentex/lib/core/services/adk/utils/__init__.py +0 -0
- agentex/lib/core/services/adk/utils/templating.py +58 -0
- agentex/lib/core/temporal/__init__.py +0 -0
- agentex/lib/core/temporal/activities/__init__.py +207 -0
- agentex/lib/core/temporal/activities/activity_helpers.py +37 -0
- agentex/lib/core/temporal/activities/adk/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +86 -0
- agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +76 -0
- agentex/lib/core/temporal/activities/adk/agents_activities.py +35 -0
- agentex/lib/core/temporal/activities/adk/events_activities.py +50 -0
- agentex/lib/core/temporal/activities/adk/messages_activities.py +94 -0
- agentex/lib/core/temporal/activities/adk/providers/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +71 -0
- agentex/lib/core/temporal/activities/adk/providers/openai_activities.py +210 -0
- agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +42 -0
- agentex/lib/core/temporal/activities/adk/state_activities.py +85 -0
- agentex/lib/core/temporal/activities/adk/streaming_activities.py +33 -0
- agentex/lib/core/temporal/activities/adk/tasks_activities.py +48 -0
- agentex/lib/core/temporal/activities/adk/tracing_activities.py +55 -0
- agentex/lib/core/temporal/activities/adk/utils/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +41 -0
- agentex/lib/core/temporal/services/__init__.py +0 -0
- agentex/lib/core/temporal/services/temporal_task_service.py +69 -0
- agentex/lib/core/temporal/types/__init__.py +0 -0
- agentex/lib/core/temporal/types/workflow.py +5 -0
- agentex/lib/core/temporal/workers/__init__.py +0 -0
- agentex/lib/core/temporal/workers/worker.py +162 -0
- agentex/lib/core/temporal/workflows/workflow.py +26 -0
- agentex/lib/core/tracing/__init__.py +5 -0
- agentex/lib/core/tracing/processors/agentex_tracing_processor.py +117 -0
- agentex/lib/core/tracing/processors/sgp_tracing_processor.py +119 -0
- agentex/lib/core/tracing/processors/tracing_processor_interface.py +40 -0
- agentex/lib/core/tracing/trace.py +311 -0
- agentex/lib/core/tracing/tracer.py +70 -0
- agentex/lib/core/tracing/tracing_processor_manager.py +62 -0
- agentex/lib/environment_variables.py +87 -0
- agentex/lib/py.typed +0 -0
- agentex/lib/sdk/__init__.py +0 -0
- agentex/lib/sdk/config/__init__.py +0 -0
- agentex/lib/sdk/config/agent_config.py +61 -0
- agentex/lib/sdk/config/agent_manifest.py +219 -0
- agentex/lib/sdk/config/build_config.py +35 -0
- agentex/lib/sdk/config/deployment_config.py +117 -0
- agentex/lib/sdk/config/local_development_config.py +56 -0
- agentex/lib/sdk/config/project_config.py +103 -0
- agentex/lib/sdk/fastacp/__init__.py +3 -0
- agentex/lib/sdk/fastacp/base/base_acp_server.py +406 -0
- agentex/lib/sdk/fastacp/fastacp.py +74 -0
- agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +72 -0
- agentex/lib/sdk/fastacp/impl/sync_acp.py +109 -0
- agentex/lib/sdk/fastacp/impl/temporal_acp.py +97 -0
- agentex/lib/sdk/fastacp/tests/README.md +297 -0
- agentex/lib/sdk/fastacp/tests/conftest.py +307 -0
- agentex/lib/sdk/fastacp/tests/pytest.ini +10 -0
- agentex/lib/sdk/fastacp/tests/run_tests.py +227 -0
- agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +450 -0
- agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +344 -0
- agentex/lib/sdk/fastacp/tests/test_integration.py +477 -0
- agentex/lib/sdk/state_machine/__init__.py +6 -0
- agentex/lib/sdk/state_machine/noop_workflow.py +21 -0
- agentex/lib/sdk/state_machine/state.py +10 -0
- agentex/lib/sdk/state_machine/state_machine.py +189 -0
- agentex/lib/sdk/state_machine/state_workflow.py +16 -0
- agentex/lib/sdk/utils/__init__.py +0 -0
- agentex/lib/sdk/utils/messages.py +223 -0
- agentex/lib/types/__init__.py +0 -0
- agentex/lib/types/acp.py +94 -0
- agentex/lib/types/agent_configs.py +79 -0
- agentex/lib/types/agent_results.py +29 -0
- agentex/lib/types/credentials.py +34 -0
- agentex/lib/types/fastacp.py +61 -0
- agentex/lib/types/files.py +13 -0
- agentex/lib/types/json_rpc.py +49 -0
- agentex/lib/types/llm_messages.py +354 -0
- agentex/lib/types/task_message_updates.py +171 -0
- agentex/lib/types/tracing.py +34 -0
- agentex/lib/utils/__init__.py +0 -0
- agentex/lib/utils/completions.py +131 -0
- agentex/lib/utils/console.py +14 -0
- agentex/lib/utils/io.py +29 -0
- agentex/lib/utils/iterables.py +14 -0
- agentex/lib/utils/json_schema.py +23 -0
- agentex/lib/utils/logging.py +31 -0
- agentex/lib/utils/mcp.py +17 -0
- agentex/lib/utils/model_utils.py +46 -0
- agentex/lib/utils/parsing.py +15 -0
- agentex/lib/utils/regex.py +6 -0
- agentex/lib/utils/temporal.py +13 -0
- agentex/py.typed +0 -0
- agentex/resources/__init__.py +103 -0
- agentex/resources/agents.py +707 -0
- agentex/resources/events.py +294 -0
- agentex/resources/messages/__init__.py +33 -0
- agentex/resources/messages/batch.py +271 -0
- agentex/resources/messages/messages.py +492 -0
- agentex/resources/spans.py +557 -0
- agentex/resources/states.py +544 -0
- agentex/resources/tasks.py +615 -0
- agentex/resources/tracker.py +384 -0
- agentex/types/__init__.py +56 -0
- agentex/types/acp_type.py +7 -0
- agentex/types/agent.py +29 -0
- agentex/types/agent_list_params.py +13 -0
- agentex/types/agent_list_response.py +10 -0
- agentex/types/agent_rpc_by_name_params.py +21 -0
- agentex/types/agent_rpc_params.py +51 -0
- agentex/types/agent_rpc_params1.py +21 -0
- agentex/types/agent_rpc_response.py +20 -0
- agentex/types/agent_rpc_result.py +90 -0
- agentex/types/agent_task_tracker.py +34 -0
- agentex/types/data_content.py +30 -0
- agentex/types/data_content_param.py +31 -0
- agentex/types/data_delta.py +14 -0
- agentex/types/event.py +29 -0
- agentex/types/event_list_params.py +22 -0
- agentex/types/event_list_response.py +10 -0
- agentex/types/message_author.py +7 -0
- agentex/types/message_create_params.py +18 -0
- agentex/types/message_list_params.py +14 -0
- agentex/types/message_list_response.py +10 -0
- agentex/types/message_style.py +7 -0
- agentex/types/message_update_params.py +18 -0
- agentex/types/messages/__init__.py +8 -0
- agentex/types/messages/batch_create_params.py +16 -0
- agentex/types/messages/batch_create_response.py +10 -0
- agentex/types/messages/batch_update_params.py +16 -0
- agentex/types/messages/batch_update_response.py +10 -0
- agentex/types/shared/__init__.py +3 -0
- agentex/types/shared/task_message_update.py +83 -0
- agentex/types/span.py +36 -0
- agentex/types/span_create_params.py +40 -0
- agentex/types/span_list_params.py +12 -0
- agentex/types/span_list_response.py +10 -0
- agentex/types/span_update_params.py +37 -0
- agentex/types/state.py +25 -0
- agentex/types/state_create_params.py +16 -0
- agentex/types/state_list_params.py +16 -0
- agentex/types/state_list_response.py +10 -0
- agentex/types/state_update_params.py +16 -0
- agentex/types/task.py +23 -0
- agentex/types/task_delete_by_name_response.py +8 -0
- agentex/types/task_delete_response.py +8 -0
- agentex/types/task_list_response.py +10 -0
- agentex/types/task_message.py +33 -0
- agentex/types/task_message_content.py +16 -0
- agentex/types/task_message_content_param.py +17 -0
- agentex/types/task_message_delta.py +16 -0
- agentex/types/text_content.py +53 -0
- agentex/types/text_content_param.py +54 -0
- agentex/types/text_delta.py +14 -0
- agentex/types/tool_request_content.py +36 -0
- agentex/types/tool_request_content_param.py +37 -0
- agentex/types/tool_request_delta.py +18 -0
- agentex/types/tool_response_content.py +36 -0
- agentex/types/tool_response_content_param.py +36 -0
- agentex/types/tool_response_delta.py +18 -0
- agentex/types/tracker_list_params.py +16 -0
- agentex/types/tracker_list_response.py +10 -0
- agentex/types/tracker_update_params.py +19 -0
- agentex_sdk-0.1.0a6.dist-info/METADATA +426 -0
- agentex_sdk-0.1.0a6.dist-info/RECORD +289 -0
- agentex_sdk-0.1.0a6.dist-info/WHEEL +4 -0
- agentex_sdk-0.1.0a6.dist-info/entry_points.txt +2 -0
- agentex_sdk-0.1.0a6.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
# Python
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
*.so
|
6
|
+
.Python
|
7
|
+
build/
|
8
|
+
develop-eggs/
|
9
|
+
dist/
|
10
|
+
downloads/
|
11
|
+
eggs/
|
12
|
+
.eggs/
|
13
|
+
lib/
|
14
|
+
lib64/
|
15
|
+
parts/
|
16
|
+
sdist/
|
17
|
+
var/
|
18
|
+
wheels/
|
19
|
+
*.egg-info/
|
20
|
+
.installed.cfg
|
21
|
+
*.egg
|
22
|
+
|
23
|
+
# Environments
|
24
|
+
.env**
|
25
|
+
.venv
|
26
|
+
env/
|
27
|
+
venv/
|
28
|
+
ENV/
|
29
|
+
env.bak/
|
30
|
+
venv.bak/
|
31
|
+
|
32
|
+
# IDE
|
33
|
+
.idea/
|
34
|
+
.vscode/
|
35
|
+
*.swp
|
36
|
+
*.swo
|
37
|
+
|
38
|
+
# Git
|
39
|
+
.git
|
40
|
+
.gitignore
|
41
|
+
|
42
|
+
# Misc
|
43
|
+
.DS_Store
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# syntax=docker/dockerfile:1.3
|
2
|
+
FROM python:3.12-slim
|
3
|
+
COPY --from=ghcr.io/astral-sh/uv:0.6.4 /uv /uvx /bin/
|
4
|
+
|
5
|
+
# Install system dependencies
|
6
|
+
RUN apt-get update && apt-get install -y \
|
7
|
+
htop \
|
8
|
+
vim \
|
9
|
+
curl \
|
10
|
+
tar \
|
11
|
+
python3-dev \
|
12
|
+
postgresql-client \
|
13
|
+
build-essential \
|
14
|
+
libpq-dev \
|
15
|
+
gcc \
|
16
|
+
cmake \
|
17
|
+
netcat-openbsd \
|
18
|
+
&& apt-get clean \
|
19
|
+
&& rm -rf /var/lib/apt/lists/*
|
20
|
+
|
21
|
+
RUN uv pip install --system --upgrade pip setuptools wheel
|
22
|
+
|
23
|
+
ENV UV_HTTP_TIMEOUT=1000
|
24
|
+
|
25
|
+
# Copy just the pyproject.toml file to optimize caching
|
26
|
+
COPY {{ project_path_from_build_root }}/pyproject.toml /app/{{ project_path_from_build_root }}/pyproject.toml
|
27
|
+
|
28
|
+
WORKDIR /app/{{ project_path_from_build_root }}
|
29
|
+
|
30
|
+
# Install the required Python packages using uv
|
31
|
+
RUN uv pip install --system .
|
32
|
+
|
33
|
+
# Copy the project code
|
34
|
+
COPY {{ project_path_from_build_root }}/project /app/{{ project_path_from_build_root }}/project
|
35
|
+
|
36
|
+
WORKDIR /app/{{ project_path_from_build_root }}/project
|
37
|
+
|
38
|
+
# Set environment variables
|
39
|
+
ENV PYTHONPATH=/app
|
40
|
+
|
41
|
+
# Run the agent using uvicorn
|
42
|
+
CMD ["uvicorn", "acp:acp", "--host", "0.0.0.0", "--port", "8000"]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# syntax=docker/dockerfile:1.3
|
2
|
+
FROM python:3.12-slim
|
3
|
+
COPY --from=ghcr.io/astral-sh/uv:0.6.4 /uv /uvx /bin/
|
4
|
+
|
5
|
+
# Install system dependencies
|
6
|
+
RUN apt-get update && apt-get install -y \
|
7
|
+
htop \
|
8
|
+
vim \
|
9
|
+
curl \
|
10
|
+
tar \
|
11
|
+
python3-dev \
|
12
|
+
postgresql-client \
|
13
|
+
build-essential \
|
14
|
+
libpq-dev \
|
15
|
+
gcc \
|
16
|
+
cmake \
|
17
|
+
netcat-openbsd \
|
18
|
+
&& apt-get clean \
|
19
|
+
&& rm -rf /var/lib/apt/lists/*
|
20
|
+
|
21
|
+
RUN uv pip install --system --upgrade pip setuptools wheel
|
22
|
+
|
23
|
+
ENV UV_HTTP_TIMEOUT=1000
|
24
|
+
|
25
|
+
# Copy just the requirements file to optimize caching
|
26
|
+
COPY {{ project_path_from_build_root }}/requirements.txt /app/{{ project_path_from_build_root }}/requirements.txt
|
27
|
+
|
28
|
+
WORKDIR /app/{{ project_path_from_build_root }}
|
29
|
+
|
30
|
+
# Install the required Python packages
|
31
|
+
RUN uv pip install --system -r requirements.txt
|
32
|
+
|
33
|
+
# Copy the project code
|
34
|
+
COPY {{ project_path_from_build_root }}/project /app/{{ project_path_from_build_root }}/project
|
35
|
+
|
36
|
+
WORKDIR /app/{{ project_path_from_build_root }}/project
|
37
|
+
|
38
|
+
# Set environment variables
|
39
|
+
ENV PYTHONPATH=/app
|
40
|
+
|
41
|
+
# Run the agent using uvicorn
|
42
|
+
CMD ["uvicorn", "acp:acp", "--host", "0.0.0.0", "--port", "8000"]
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# {{ agent_name }} - AgentEx Starter Template
|
2
|
+
|
3
|
+
This is a generic starter template for building agents with the AgentEx framework. It provides a basic implementation of the Agent 2 Client Protocol (ACP) to help you get started quickly.
|
4
|
+
|
5
|
+
## What You'll Learn
|
6
|
+
|
7
|
+
- **Tasks**: A task is a grouping mechanism for related messages. Think of it as a conversation thread or a session.
|
8
|
+
- **Messages**: Messages are communication objects within a task. They can contain text, data, or instructions.
|
9
|
+
- **ACP Events**: The agent responds to four main events:
|
10
|
+
- `task_received`: When a new task is created
|
11
|
+
- `task_message_received`: When a message is sent within a task
|
12
|
+
- `task_approved`: When a task is approved
|
13
|
+
- `task_canceled`: When a task is canceled
|
14
|
+
|
15
|
+
## Running the Agent
|
16
|
+
|
17
|
+
1. Run the agent locally:
|
18
|
+
```bash
|
19
|
+
agentex agents run --manifest manifest.yaml
|
20
|
+
```
|
21
|
+
|
22
|
+
The agent will start on port 8000 and print messages whenever it receives any of the ACP events.
|
23
|
+
|
24
|
+
## What's Inside
|
25
|
+
|
26
|
+
This template:
|
27
|
+
- Sets up a basic ACP server
|
28
|
+
- Handles each of the required ACP events with simple print statements
|
29
|
+
- Provides a foundation for building more complex agents
|
30
|
+
|
31
|
+
## Next Steps
|
32
|
+
|
33
|
+
For more advanced agent development, check out the AgentEx tutorials:
|
34
|
+
|
35
|
+
- **Tutorials 00-08**: Learn about building synchronous agents with ACP
|
36
|
+
- **Tutorials 09-10**: Learn how to use Temporal to power asynchronous agents
|
37
|
+
- Tutorial 09: Basic Temporal workflow setup
|
38
|
+
- Tutorial 10: Advanced Temporal patterns and best practices
|
39
|
+
|
40
|
+
These tutorials will help you understand:
|
41
|
+
- How to handle long-running tasks
|
42
|
+
- Implementing state machines
|
43
|
+
- Managing complex workflows
|
44
|
+
- Best practices for async agent development
|
45
|
+
|
46
|
+
## The Manifest File
|
47
|
+
|
48
|
+
The `manifest.yaml` file is your agent's configuration file. It defines:
|
49
|
+
- How your agent should be built and packaged
|
50
|
+
- What files are included in your agent's Docker image
|
51
|
+
- Your agent's name and description
|
52
|
+
- Local development settings (like the port your agent runs on)
|
53
|
+
|
54
|
+
This file is essential for both local development and deployment of your agent.
|
55
|
+
|
56
|
+
## Project Structure
|
57
|
+
|
58
|
+
```
|
59
|
+
{{ project_name }}/
|
60
|
+
├── project/ # Your agent's code
|
61
|
+
│ ├── __init__.py
|
62
|
+
│ └── acp.py # ACP server and event handlers
|
63
|
+
├── Dockerfile # Container definition
|
64
|
+
├── manifest.yaml # Deployment config
|
65
|
+
{% if use_uv %}
|
66
|
+
└── pyproject.toml # Dependencies (uv)
|
67
|
+
{% else %}
|
68
|
+
└── requirements.txt # Dependencies (pip)
|
69
|
+
{% endif %}
|
70
|
+
```
|
71
|
+
|
72
|
+
## Development
|
73
|
+
|
74
|
+
### 1. Customize Event Handlers
|
75
|
+
- Modify the handlers in `acp.py` to implement your agent's logic
|
76
|
+
- Add your own tools and capabilities
|
77
|
+
- Implement custom state management
|
78
|
+
|
79
|
+
### 2. Manage Dependencies
|
80
|
+
|
81
|
+
{% if use_uv %}
|
82
|
+
You chose **uv** for package management. Here's how to work with dependencies:
|
83
|
+
|
84
|
+
```bash
|
85
|
+
# Add new dependencies
|
86
|
+
agentex uv add requests openai anthropic
|
87
|
+
|
88
|
+
# Install/sync dependencies
|
89
|
+
agentex uv sync
|
90
|
+
|
91
|
+
# Run commands with uv
|
92
|
+
uv run agentex agents run --manifest manifest.yaml
|
93
|
+
```
|
94
|
+
|
95
|
+
**Benefits of uv:**
|
96
|
+
- Faster dependency resolution and installation
|
97
|
+
- Better dependency isolation
|
98
|
+
- Modern Python packaging standards
|
99
|
+
|
100
|
+
{% else %}
|
101
|
+
You chose **pip** for package management. Here's how to work with dependencies:
|
102
|
+
|
103
|
+
```bash
|
104
|
+
# Edit requirements.txt manually to add dependencies
|
105
|
+
echo "requests" >> requirements.txt
|
106
|
+
echo "openai" >> requirements.txt
|
107
|
+
|
108
|
+
# Install dependencies
|
109
|
+
pip install -r requirements.txt
|
110
|
+
```
|
111
|
+
|
112
|
+
**Benefits of pip:**
|
113
|
+
- Familiar workflow for most Python developers
|
114
|
+
- Simple requirements.txt management
|
115
|
+
- Wide compatibility
|
116
|
+
{% endif %}
|
117
|
+
|
118
|
+
### 3. Configure Credentials
|
119
|
+
Options:
|
120
|
+
1. Add any required credentials to your manifest.yaml via the `env` section
|
121
|
+
2. Export them in your shell: `export OPENAI_API_KEY=...`
|
122
|
+
3. For local development, create a `.env.local` file in the project directory
|
123
|
+
|
124
|
+
```python
|
125
|
+
import os
|
126
|
+
from dotenv import load_dotenv
|
127
|
+
|
128
|
+
if os.environ.get("ENVIRONMENT") == "development":
|
129
|
+
load_dotenv()
|
130
|
+
```
|
131
|
+
|
132
|
+
## Local Development
|
133
|
+
|
134
|
+
|
135
|
+
### 1. Start the Agentex Backend
|
136
|
+
```bash
|
137
|
+
# Navigate to the backend directory
|
138
|
+
cd agentex
|
139
|
+
|
140
|
+
# Start all services using Docker Compose
|
141
|
+
make dev
|
142
|
+
|
143
|
+
# Optional: In a separate terminal, use lazydocker for a better UI (everything should say "healthy")
|
144
|
+
lzd
|
145
|
+
```
|
146
|
+
|
147
|
+
### 2. Setup Your Agent's requirements/pyproject.toml
|
148
|
+
```bash
|
149
|
+
agentex uv sync [--group editable-apy]
|
150
|
+
source .venv/bin/activate
|
151
|
+
|
152
|
+
# OR
|
153
|
+
conda create -n {{ project_name }} python=3.12
|
154
|
+
conda activate {{ project_name }}
|
155
|
+
pip install -r requirements.txt
|
156
|
+
```
|
157
|
+
### 3. Run Your Agent
|
158
|
+
```bash
|
159
|
+
# From this directory
|
160
|
+
export ENVIRONMENT=development && [uv run] agentex agents run --manifest manifest.yaml
|
161
|
+
```
|
162
|
+
|
163
|
+
### 4. Interact with Your Agent
|
164
|
+
|
165
|
+
Option 0: CLI (deprecated - to be replaced once a new CLI is implemented - please use the web UI for now!)
|
166
|
+
```bash
|
167
|
+
# Submit a task via CLI
|
168
|
+
agentex tasks submit --agent {{ agent_name }} --task "Your task here"
|
169
|
+
```
|
170
|
+
|
171
|
+
Option 1: Web UI
|
172
|
+
```bash
|
173
|
+
# Start the local web interface
|
174
|
+
cd agentex-web
|
175
|
+
make dev
|
176
|
+
|
177
|
+
# Then open http://localhost:3000 in your browser to chat with your agent
|
178
|
+
```
|
179
|
+
|
180
|
+
## Development Tips
|
181
|
+
|
182
|
+
### Environment Variables
|
183
|
+
- Set environment variables in project/.env for any required credentials
|
184
|
+
- Or configure them in the manifest.yaml under the `env` section
|
185
|
+
- The `.env` file is automatically loaded in development mode
|
186
|
+
|
187
|
+
### To build the agent Docker image locally (normally not necessary):
|
188
|
+
|
189
|
+
1. Build the agent image:
|
190
|
+
```bash
|
191
|
+
agentex agents build --manifest manifest.yaml
|
192
|
+
```
|
193
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Example Override Configuration
|
2
|
+
# =============================
|
3
|
+
# This file shows how to override deployment settings from the global defaults in manifest.yaml.
|
4
|
+
# You can create multiple override files for different environments (e.g., staging.yaml, prod.yaml, dev.yaml)
|
5
|
+
# Only specify values that differ from the global defaults in manifest.yaml
|
6
|
+
|
7
|
+
# Override image tag
|
8
|
+
# image:
|
9
|
+
# tag: "v1.2.3"
|
10
|
+
|
11
|
+
# Override replica count
|
12
|
+
# replicaCount: 2
|
13
|
+
|
14
|
+
# Environment-specific environment variables
|
15
|
+
# env:
|
16
|
+
# - name: LOG_LEVEL
|
17
|
+
# value: "DEBUG"
|
18
|
+
# - name: ENVIRONMENT
|
19
|
+
# value: "staging"
|
20
|
+
|
21
|
+
# Override resource requirements
|
22
|
+
# resources:
|
23
|
+
# requests:
|
24
|
+
# cpu: "250m"
|
25
|
+
# memory: "512Mi"
|
26
|
+
# limits:
|
27
|
+
# cpu: "500m"
|
28
|
+
# memory: "1Gi"
|
29
|
+
|
30
|
+
# Advanced: Additional helm chart value overrides
|
31
|
+
# Use this for any helm chart values not covered by the simple options above
|
32
|
+
# additional_overrides:
|
33
|
+
# autoscaling:
|
34
|
+
# enabled: true
|
35
|
+
# minReplicas: 2
|
36
|
+
# maxReplicas: 10
|
37
|
+
# targetCPUUtilizationPercentage: 70
|
38
|
+
#
|
39
|
+
# service:
|
40
|
+
# type: LoadBalancer
|
41
|
+
#
|
42
|
+
# ingress:
|
43
|
+
# enabled: true
|
44
|
+
# annotations:
|
45
|
+
# kubernetes.io/ingress.class: "nginx"
|
46
|
+
# hosts:
|
47
|
+
# - host: {{ agent_name }}.example.com
|
48
|
+
# paths:
|
49
|
+
# - path: /
|
50
|
+
# pathType: Prefix
|
51
|
+
|
52
|
+
# To use this configuration:
|
53
|
+
# 1. Copy this file to a new file (e.g., staging.yaml, prod.yaml)
|
54
|
+
# 2. Uncomment and modify the values you want to override
|
55
|
+
# 3. Deploy with: agentex agents deploy --cluster your-cluster --namespace your-namespace --override-file staging.yaml
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Agent Manifest Configuration
|
2
|
+
# ---------------------------
|
3
|
+
# This file defines how your agent should be built and deployed.
|
4
|
+
|
5
|
+
# Build Configuration
|
6
|
+
# ------------------
|
7
|
+
# The build config defines what gets packaged into your agent's Docker image.
|
8
|
+
# This same configuration is used whether building locally or remotely.
|
9
|
+
#
|
10
|
+
# When building:
|
11
|
+
# 1. All files from include_paths are collected into a build context
|
12
|
+
# 2. The context is filtered by dockerignore rules
|
13
|
+
# 3. The Dockerfile uses this context to build your agent's image
|
14
|
+
# 4. The image is pushed to a registry and used to run your agent
|
15
|
+
build:
|
16
|
+
context:
|
17
|
+
# Root directory for the build context
|
18
|
+
root: ../ # Keep this as the default root
|
19
|
+
|
20
|
+
# Paths to include in the Docker build context
|
21
|
+
# Must include:
|
22
|
+
# - Your agent's directory (your custom agent code)
|
23
|
+
# These paths are collected and sent to the Docker daemon for building
|
24
|
+
include_paths:
|
25
|
+
- {{ project_path_from_build_root }}
|
26
|
+
|
27
|
+
# Path to your agent's Dockerfile
|
28
|
+
# This defines how your agent's image is built from the context
|
29
|
+
# Relative to the root directory
|
30
|
+
dockerfile: {{ project_path_from_build_root }}/Dockerfile
|
31
|
+
|
32
|
+
# Path to your agent's .dockerignore
|
33
|
+
# Filters unnecessary files from the build context
|
34
|
+
# Helps keep build context small and builds fast
|
35
|
+
dockerignore: {{ project_path_from_build_root }}/.dockerignore
|
36
|
+
|
37
|
+
|
38
|
+
# Local Development Configuration
|
39
|
+
# -----------------------------
|
40
|
+
# Only used when running the agent locally
|
41
|
+
local_development:
|
42
|
+
agent:
|
43
|
+
port: 8000 # Port where your local ACP server is running
|
44
|
+
host_address: host.docker.internal # Host address for Docker networking (host.docker.internal for Docker, localhost for direct)
|
45
|
+
|
46
|
+
# File paths for local development (relative to this manifest.yaml)
|
47
|
+
paths:
|
48
|
+
# Path to ACP server file
|
49
|
+
# Examples:
|
50
|
+
# project/acp.py (standard)
|
51
|
+
# src/server.py (custom structure)
|
52
|
+
# ../shared/acp.py (shared across projects)
|
53
|
+
# /absolute/path/acp.py (absolute path)
|
54
|
+
acp: project/acp.py
|
55
|
+
|
56
|
+
|
57
|
+
# Agent Configuration
|
58
|
+
# -----------------
|
59
|
+
agent:
|
60
|
+
acp_type: agentic
|
61
|
+
|
62
|
+
# Unique name for your agent
|
63
|
+
# Used for task routing and monitoring
|
64
|
+
name: {{ agent_name }}
|
65
|
+
|
66
|
+
# Description of what your agent does
|
67
|
+
# Helps with documentation and discovery
|
68
|
+
description: {{ description }}
|
69
|
+
|
70
|
+
# Temporal workflow configuration
|
71
|
+
# Set enabled: true to use Temporal workflows for long-running tasks
|
72
|
+
temporal:
|
73
|
+
enabled: false
|
74
|
+
|
75
|
+
# Optional: Credentials mapping
|
76
|
+
# Maps Kubernetes secrets to environment variables
|
77
|
+
# Common credentials include:
|
78
|
+
# credentials:
|
79
|
+
# - env_var_name: OPENAI_API_KEY
|
80
|
+
# secret_name: openai-api-key
|
81
|
+
# secret_key: api-key
|
82
|
+
|
83
|
+
# Optional: Set Environment variables for running your agent locally as well
|
84
|
+
# as for deployment later on
|
85
|
+
# env:
|
86
|
+
# OPENAI_API_KEY: "<YOUR_OPENAI_API_KEY_HERE>"
|
87
|
+
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
|
88
|
+
# OPENAI_ORG_ID: "<YOUR_OPENAI_ORG_ID_HERE>"
|
89
|
+
|
90
|
+
# Deployment Configuration
|
91
|
+
# -----------------------
|
92
|
+
# Configuration for deploying your agent to Kubernetes clusters
|
93
|
+
deployment:
|
94
|
+
# Container image configuration
|
95
|
+
image:
|
96
|
+
repository: "" # Update with your container registry
|
97
|
+
tag: "latest" # Default tag, should be versioned in production
|
98
|
+
|
99
|
+
# Global deployment settings that apply to all clusters
|
100
|
+
# These can be overridden in cluster-specific files (deploy/*.yaml)
|
101
|
+
global:
|
102
|
+
agent:
|
103
|
+
name: "{{ agent_name }}"
|
104
|
+
description: "{{ description }}"
|
105
|
+
|
106
|
+
# Default replica count
|
107
|
+
replicaCount: 1
|
108
|
+
|
109
|
+
# Default resource requirements
|
110
|
+
resources:
|
111
|
+
requests:
|
112
|
+
cpu: "500m"
|
113
|
+
memory: "1Gi"
|
114
|
+
limits:
|
115
|
+
cpu: "1000m"
|
116
|
+
memory: "2Gi"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from agentex.lib.sdk.fastacp.fastacp import FastACP
|
2
|
+
from agentex.lib.types.fastacp import AgenticACPConfig
|
3
|
+
from agentex.lib.types.acp import SendEventParams, CancelTaskParams, CreateTaskParams
|
4
|
+
|
5
|
+
|
6
|
+
# Create an ACP server
|
7
|
+
acp = FastACP.create(
|
8
|
+
acp_type="agentic",
|
9
|
+
config=AgenticACPConfig(type="base")
|
10
|
+
)
|
11
|
+
|
12
|
+
|
13
|
+
@acp.on_task_event_send
|
14
|
+
async def handle_task_event_send(params: SendEventParams):
|
15
|
+
# For this tutorial, we print the parameters sent to the handler
|
16
|
+
# so you can see where and how messages within a task are handled
|
17
|
+
print(f"Hello world! I just received this message: {params}")
|
18
|
+
|
19
|
+
@acp.on_task_cancel
|
20
|
+
async def handle_task_canceled(params: CancelTaskParams):
|
21
|
+
# For this tutorial, we print the parameters sent to the handler
|
22
|
+
# so you can see where and how task cancellation is handled
|
23
|
+
print(f"Hello world! Task canceled: {params.task.id}")
|
24
|
+
|
25
|
+
@acp.on_task_create
|
26
|
+
async def handle_task_create(params: CreateTaskParams):
|
27
|
+
# For this tutorial, we print the parameters sent to the handler
|
28
|
+
# so you can see where and how task creation is handled
|
29
|
+
print(f"Hello world! Task created: {params.task.id}")
|
@@ -0,0 +1,33 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["hatchling"]
|
3
|
+
build-backend = "hatchling.build"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "{{ project_name }}"
|
7
|
+
version = "0.1.0"
|
8
|
+
description = "{{ description }}"
|
9
|
+
readme = "README.md"
|
10
|
+
requires-python = ">=3.12"
|
11
|
+
dependencies = [
|
12
|
+
"agentex-sdk",
|
13
|
+
"scale-gp",
|
14
|
+
]
|
15
|
+
|
16
|
+
[project.optional-dependencies]
|
17
|
+
dev = [
|
18
|
+
"pytest",
|
19
|
+
"black",
|
20
|
+
"isort",
|
21
|
+
"flake8",
|
22
|
+
]
|
23
|
+
|
24
|
+
[tool.hatch.build.targets.wheel]
|
25
|
+
packages = ["project"]
|
26
|
+
|
27
|
+
[tool.black]
|
28
|
+
line-length = 88
|
29
|
+
target-version = ['py312']
|
30
|
+
|
31
|
+
[tool.isort]
|
32
|
+
profile = "black"
|
33
|
+
line_length = 88
|
Binary file
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Example Override Configuration
|
2
|
+
# =============================
|
3
|
+
# This file shows how to override deployment settings from the global defaults in manifest.yaml.
|
4
|
+
# You can create multiple override files for different environments (e.g., staging.yaml, prod.yaml, dev.yaml)
|
5
|
+
# Only specify values that differ from the global defaults in manifest.yaml
|
6
|
+
|
7
|
+
# Override image tag
|
8
|
+
# image:
|
9
|
+
# tag: "v1.2.3"
|
10
|
+
|
11
|
+
# Override replica count
|
12
|
+
# replicaCount: 2
|
13
|
+
|
14
|
+
# Environment-specific environment variables
|
15
|
+
# env:
|
16
|
+
# - name: LOG_LEVEL
|
17
|
+
# value: "DEBUG"
|
18
|
+
# - name: ENVIRONMENT
|
19
|
+
# value: "staging"
|
20
|
+
|
21
|
+
# Override resource requirements
|
22
|
+
# resources:
|
23
|
+
# requests:
|
24
|
+
# cpu: "250m"
|
25
|
+
# memory: "512Mi"
|
26
|
+
# limits:
|
27
|
+
# cpu: "500m"
|
28
|
+
# memory: "1Gi"
|
29
|
+
|
30
|
+
# Advanced: Additional helm chart value overrides
|
31
|
+
# Use this for any helm chart values not covered by the simple options above
|
32
|
+
# additional_overrides:
|
33
|
+
# autoscaling:
|
34
|
+
# enabled: true
|
35
|
+
# minReplicas: 2
|
36
|
+
# maxReplicas: 10
|
37
|
+
# targetCPUUtilizationPercentage: 70
|
38
|
+
#
|
39
|
+
# service:
|
40
|
+
# type: LoadBalancer
|
41
|
+
#
|
42
|
+
# ingress:
|
43
|
+
# enabled: true
|
44
|
+
# annotations:
|
45
|
+
# kubernetes.io/ingress.class: "nginx"
|
46
|
+
# hosts:
|
47
|
+
# - host: {{ agent_name }}.example.com
|
48
|
+
# paths:
|
49
|
+
# - path: /
|
50
|
+
# pathType: Prefix
|
51
|
+
|
52
|
+
# To use this configuration:
|
53
|
+
# 1. Copy this file to a new file (e.g., staging.yaml, prod.yaml)
|
54
|
+
# 2. Uncomment and modify the values you want to override
|
55
|
+
# 3. Deploy with: agentex agents deploy --cluster your-cluster --namespace your-namespace --override-file staging.yaml
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Python
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
*.so
|
6
|
+
.Python
|
7
|
+
build/
|
8
|
+
develop-eggs/
|
9
|
+
dist/
|
10
|
+
downloads/
|
11
|
+
eggs/
|
12
|
+
.eggs/
|
13
|
+
lib/
|
14
|
+
lib64/
|
15
|
+
parts/
|
16
|
+
sdist/
|
17
|
+
var/
|
18
|
+
wheels/
|
19
|
+
*.egg-info/
|
20
|
+
.installed.cfg
|
21
|
+
*.egg
|
22
|
+
|
23
|
+
# Environments
|
24
|
+
.env**
|
25
|
+
.venv
|
26
|
+
env/
|
27
|
+
venv/
|
28
|
+
ENV/
|
29
|
+
env.bak/
|
30
|
+
venv.bak/
|
31
|
+
|
32
|
+
# IDE
|
33
|
+
.idea/
|
34
|
+
.vscode/
|
35
|
+
*.swp
|
36
|
+
*.swo
|
37
|
+
|
38
|
+
# Git
|
39
|
+
.git
|
40
|
+
.gitignore
|
41
|
+
|
42
|
+
# Misc
|
43
|
+
.DS_Store
|