Skip to content

Commit 7046381

Browse files
authored
Adding accepted content type for agents (#172)
* init * add CLI support * Update init.py
1 parent a08a0a5 commit 7046381

File tree

8 files changed

+31
-0
lines changed

8 files changed

+31
-0
lines changed

src/agentex/lib/cli/commands/init.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ def validate_agent_name(text: str) -> bool | str:
184184
).ask()
185185
if not description:
186186
return
187+
188+
agent_input_type = questionary.select(
189+
"What type of input will your agent handle?",
190+
choices=[
191+
{"name": "Text Input", "value": "text"},
192+
{"name": "Structured Input", "value": "json"},
193+
],
194+
).ask()
195+
if not agent_input_type:
196+
return
187197

188198
use_uv = questionary.select(
189199
"Would you like to use uv for package management?",
@@ -196,6 +206,7 @@ def validate_agent_name(text: str) -> bool | str:
196206
answers = {
197207
"template_type": template_type,
198208
"project_path": project_path,
209+
"agent_input_type": agent_input_type,
199210
"agent_name": agent_name,
200211
"agent_directory_name": agent_directory_name,
201212
"description": description,

src/agentex/lib/cli/handlers/run_handlers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]:
372372
"ACP_PORT": str(manifest.local_development.agent.port), # type: ignore[union-attr]
373373
}
374374

375+
if manifest.agent.agent_input_type:
376+
env_vars["AGENT_INPUT_TYPE"] = manifest.agent.agent_input_type
377+
375378
# Add authorization principal if set - for local development, auth is optional
376379
from agentex.lib.cli.utils.auth_utils import _encode_principal_context
377380
encoded_principal = _encode_principal_context(manifest)

src/agentex/lib/cli/templates/default/manifest.yaml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ agent:
6767
# Helps with documentation and discovery
6868
description: {{ description }}
6969

70+
# Type of input the agent will handle: text or json
71+
agent_input_type: {{ agent_input_type }}
72+
7073
# Temporal workflow configuration
7174
# Set enabled: true to use Temporal workflows for long-running tasks
7275
temporal:

src/agentex/lib/cli/templates/sync/manifest.yaml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ agent:
6666
# Helps with documentation and discovery
6767
description: {{ description }}
6868

69+
# Type of input the agent will handle: text or json
70+
agent_input_type: {{ agent_input_type }}
71+
6972
# Temporal workflow configuration
7073
# Set enabled: true to use Temporal workflows for long-running tasks
7174
temporal:

src/agentex/lib/cli/templates/temporal/manifest.yaml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ agent:
7575
# Helps with documentation and discovery
7676
description: {{ description }}
7777

78+
# Type of input the agent will handle: text or json
79+
agent_input_type: {{ agent_input_type }}
80+
7881
# Temporal workflow configuration
7982
# This enables your agent to run as a Temporal workflow for long-running tasks
8083
temporal:

src/agentex/lib/environment_variables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class EnvVarKeys(str, Enum):
3838
AUTH_PRINCIPAL_B64 = "AUTH_PRINCIPAL_B64"
3939
# Build Information
4040
BUILD_INFO_PATH = "BUILD_INFO_PATH"
41+
AGENT_INPUT_TYPE = "AGENT_INPUT_TYPE"
4142

4243

4344
class Environment(str, Enum):
@@ -61,6 +62,7 @@ class EnvironmentVariables(BaseModel):
6162
AGENT_ID: str | None = None
6263
AGENT_API_KEY: str | None = None
6364
ACP_TYPE: str | None = "agentic"
65+
AGENT_INPUT_TYPE: str | None = None
6466
# ACP Configuration
6567
ACP_URL: str
6668
ACP_PORT: int = 8000

src/agentex/lib/sdk/config/agent_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class AgentConfig(BaseModel):
1919
pattern=r"^[a-z0-9-]+$",
2020
)
2121
acp_type: Literal["sync", "agentic"] = Field(..., description="The type of agent.")
22+
agent_input_type: Literal["text", "json"] | None = Field(
23+
default=None,
24+
description="The type of input the agent accepts."
25+
)
2226
description: str = Field(..., description="The description of the agent.")
2327
env: dict[str, str] | None = Field(
2428
default=None, description="Environment variables to set directly in the agent deployment"

src/agentex/lib/utils/registration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ async def register_agent(env_vars: EnvironmentVariables):
5656

5757
if env_vars.AGENT_ID:
5858
registration_data["agent_id"] = env_vars.AGENT_ID
59+
if env_vars.AGENT_INPUT_TYPE:
60+
registration_data["agent_input_type"] = env_vars.AGENT_INPUT_TYPE
5961

6062
# Make the registration request
6163
registration_url = f"{env_vars.AGENTEX_BASE_URL.rstrip('/')}/agents/register"

0 commit comments

Comments
 (0)