Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/agentex/lib/cli/templates/default/manifest.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ agent:

# Optional: Set Environment variables for running your agent locally as well
# as for deployment later on
# env:
env: {}
# OPENAI_API_KEY: "<YOUR_OPENAI_API_KEY_HERE>"
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
# OPENAI_ORG_ID: "<YOUR_OPENAI_ORG_ID_HERE>"
Expand All @@ -100,13 +100,12 @@ deployment:
repository: "" # Update with your container registry
tag: "latest" # Default tag, should be versioned in production

imagePullSecrets: [] # Update with your image pull secret names
# - name: my-registry-secret

# Global deployment settings that apply to all clusters
# These can be overridden in cluster-specific files (deploy/*.yaml)
# These can be overridden in cluster-specific environments (environments.yaml)
global:
agent:
name: "{{ agent_name }}"
description: "{{ description }}"

# Default replica count
replicaCount: 1

Expand Down
41 changes: 34 additions & 7 deletions src/agentex/lib/cli/templates/default/project/acp.py.j2
Original file line number Diff line number Diff line change
@@ -1,29 +1,56 @@
from agentex.lib.sdk.fastacp.fastacp import FastACP
from agentex.lib.types.fastacp import AsyncACPConfig
from agentex.lib.types.acp import SendEventParams, CancelTaskParams, CreateTaskParams
from agentex.lib.utils.logging import make_logger
from agentex.types.text_content import TextContent
from agentex.lib import adk


logger = make_logger(__name__)


# Create an ACP server
# This sets up the core server that will handle task creation, events, and cancellation
# The `type="base"` configuration is the default configuration for the ACP server
acp = FastACP.create(
acp_type="async",
config=AsyncACPConfig(type="base")
config=AsyncACPConfig(
type="base",
),
)


# This handler is called first whenever a new task is created.
# It's a good place to initialize any state or resources needed for the task.
@acp.on_task_event_send
async def handle_task_event_send(params: SendEventParams):
# For this tutorial, we print the parameters sent to the handler
# so you can see where and how messages within a task are handled
print(f"Hello world! I just received this message: {params}")
# For this tutorial, we log the parameters sent to the handler
# so you can see where and how messages within a long running task are handled
logger.info(f"Received task event send rpc: {params}")

# 1. Echo back the client's message to show it in the UI. This is not done by default so the agent developer has full control over what is shown to the user.
await adk.messages.create(task_id=params.task.id, content=params.event.content)

# 2. Send a simple response message.
# In future tutorials, this is where we'll add more sophisticated response logic.
await adk.messages.create(
task_id=params.task.id,
content=TextContent(
author="agent",
content=f"Hello! I've received your message. I can't respond right now, but in future tutorials we'll see how you can get me to intelligently respond to your message.",
),
)

@acp.on_task_cancel
async def handle_task_canceled(params: CancelTaskParams):
# For this tutorial, we print the parameters sent to the handler
# so you can see where and how task cancellation is handled
print(f"Hello world! Task canceled: {params.task.id}")
logger.info(f"Received task cancel rpc: {params}")

@acp.on_task_create
async def handle_task_create(params: CreateTaskParams):
# For this tutorial, we print the parameters sent to the handler
# For this tutorial, we log the parameters sent to the handler
# so you can see where and how task creation is handled
print(f"Hello world! Task created: {params.task.id}")

# Here is where you can initialize any state or resources needed for the task.
logger.info(f"Received task create rpc: {params}")
13 changes: 6 additions & 7 deletions src/agentex/lib/cli/templates/sync/manifest.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ agent:
# Optional: Credentials mapping
# Maps Kubernetes secrets to environment variables
# Common credentials include:
# credentials:
credentials: [] # Update with your credentials
# - env_var_name: OPENAI_API_KEY
# secret_name: openai-api-key
# secret_key: api-key

# Optional: Set Environment variables for running your agent locally as well
# as for deployment later on
# env:
env: {} # Update with your environment variables
# OPENAI_API_KEY: "<YOUR_OPENAI_API_KEY_HERE>"
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
# OPENAI_ORG_ID: "<YOUR_OPENAI_ORG_ID_HERE>"
Expand All @@ -95,14 +95,13 @@ deployment:
image:
repository: "" # Update with your container registry
tag: "latest" # Default tag, should be versioned in production

imagePullSecrets: [] # Update with your image pull secret names
# - name: my-registry-secret

# Global deployment settings that apply to all clusters
# These can be overridden in cluster-specific files (deploy/*.yaml)
# These can be overridden in cluster-specific environments (environments.yaml)
global:
agent:
name: "{{ agent_name }}"
description: "{{ description }}"

# Default replica count
replicaCount: 1

Expand Down
12 changes: 4 additions & 8 deletions src/agentex/lib/cli/templates/temporal/manifest.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ agent:

# Optional: Set Environment variables for running your agent locally as well
# as for deployment later on
# env:
env: {}
# OPENAI_API_KEY: "<YOUR_OPENAI_API_KEY_HERE>"
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
# OPENAI_ORG_ID: "<YOUR_OPENAI_ORG_ID_HERE>"
Expand All @@ -121,16 +121,12 @@ deployment:
repository: "" # Update with your container registry
tag: "latest" # Default tag, should be versioned in production

imagePullSecrets:
- name: my-registry-secret # Update with your image pull secret name
imagePullSecrets: [] # Update with your image pull secret name
# - name: my-registry-secret

# Global deployment settings that apply to all clusters
# These can be overridden using --override-file with custom configuration files
# These can be overridden in cluster-specific environments (environments.yaml)
global:
agent:
name: "{{ agent_name }}"
description: "{{ description }}"

# Default replica count
replicaCount: 1

Expand Down