Skip to content

Commit 4bb7702

Browse files
author
James Nguyen
committed
feat(dea): parameterize agent_name, env, domain and add AGENT_TYPE_URI extension
1 parent a302879 commit 4bb7702

4 files changed

Lines changed: 52 additions & 5 deletions

File tree

datasets/dea-tools/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ This file is the main driver that dictates how evaluations are executed. Key par
2323
* `simulated_user_model_config`: Points to the model acting as the user (Gemini 2.5 Pro).
2424
* `dataset_config`: Points to the Dataset JSON file (described in Step 1).
2525
* `env` block: Sets local variables like `EVAL_DATAFORM_SETUP_ENV_FILES_DIR` to inject existing files (e.g., workspace settings, schema definitions) into the workspace before the agent runs. This allows the agent to build on top of an established environment instead of starting from scratch.
26+
27+
### Parameterized Agent & Environment Configuration:
28+
The model configuration file is defined in `datasets/dea-tools/example_model_config.yaml`. In your model configuration YAML file, you can configure target environments and agent personas:
29+
30+
```yaml
31+
generator: "data_engineering_agent"
32+
gcp_project_id: !ENV ${EVAL_GCP_PROJECT_ID}
33+
gcp_region: !ENV ${EVAL_GCP_PROJECT_REGION}
34+
35+
# Parameterized Agent Options:
36+
env: staging # Target environment: "staging" or "prod" (defaults to "prod")
37+
agent_name: sparkagent # Persona/Agent name: "sparkagent" or "dataengineeringagent"
38+
domain: "" # Optional custom host override (e.g., "https://staging-geminidataanalytics.sandbox.googleapis.com")
39+
```
40+
41+
* **`env`**: Configures the host environment (`staging` uses `https://staging-geminidataanalytics.sandbox.googleapis.com`, `prod` uses `https://geminidataanalytics.googleapis.com`).
42+
* **`agent_name`**: Sets the agent persona path parameter (`/v1/a2a/.../agents/{agent_name}`) and automatically attaches the `AGENT_TYPE_URI` metadata header extension (`"SPARK_AGENT"`).
43+
* **`domain`**: (Optional) Fully overrides the target base host.
2644
* `scorers`: Defines the evaluation scorers:
2745
* `binary_rubric_scorer`: Grader that evaluates the conversation against the `binary_rubric` (gives 0 or 100).
2846
* `dataform_cloud_compile` & `dataform_cloud_run`: Cloud verifiers that compile and run the generated SQLX files in GCP to ensure they are physically valid.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generator: "data_engineering_agent"
2+
gcp_project_id: !ENV ${EVAL_GCP_PROJECT_ID}
3+
gcp_region: !ENV ${EVAL_GCP_PROJECT_REGION}
4+
env: prod
5+
agent_name: dataengineeringagent
6+
execs_per_minute: 10

datasets/dea-tools/example_run_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
orchestrator: dea
22
dataset_format: dea-format
3-
model_config: datasets/model_configs/gcp_data_engineering_agent_model.yaml
3+
model_config: datasets/dea-tools/example_model_config.yaml
44
simulated_user_model_config: datasets/model_configs/gemini_2.5_pro_model.yaml
55
dataset_config: datasets/dea-tools/dea-live-conversational.evalset.json
66
env:

evalbench/generators/models/gcp_data_engineering_agent.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@
5050
"https://geminidataanalytics.googleapis.com/a2a/extensions/"
5151
"finishreason/v1"
5252
)
53+
AGENT_TYPE_URI = (
54+
"https://geminidataanalytics.googleapis.com/a2a/extensions/"
55+
"agenttype/v1"
56+
)
5357

5458
# All required A2A Extension Headers combined
5559
ALL_EXTENSIONS = (
5660
f"{MESSAGE_LEVEL_URI},{INSTRUCTION_URI},{GCP_RESOURCE_URI},"
57-
f"{CONVERSATION_TOKEN_URI},{FINISH_REASON_URI}"
61+
f"{CONVERSATION_TOKEN_URI},{FINISH_REASON_URI},{AGENT_TYPE_URI}"
5862
)
5963

6064
logger = logging.getLogger(__name__)
@@ -211,6 +215,11 @@ def __init__(self, querygenerator_config: dict[str, Any]):
211215
self.name = "data_engineering_agent"
212216
gcp_project_id = querygenerator_config.get("gcp_project_id", "")
213217
gcp_region = querygenerator_config.get("gcp_region", "")
218+
env_val = querygenerator_config.get("env", "prod")
219+
env = env_val.lower() if isinstance(env_val, str) else "prod"
220+
agent_name = querygenerator_config.get("agent_name", "dataengineeringagent")
221+
domain = querygenerator_config.get("domain", "")
222+
self.agent_name = agent_name
214223

215224
if not gcp_project_id:
216225
raise ValueError(
@@ -223,10 +232,19 @@ def __init__(self, querygenerator_config: dict[str, Any]):
223232
"DataEngineeringAgentGenerator."
224233
)
225234

235+
if domain:
236+
if not (domain.startswith("http://") or domain.startswith("https://")):
237+
host = f"https://{domain}"
238+
else:
239+
host = domain
240+
elif env == "staging":
241+
host = "https://staging-geminidataanalytics.sandbox.googleapis.com"
242+
else:
243+
host = "https://geminidataanalytics.googleapis.com"
244+
226245
self.endpoint = (
227-
f"https://geminidataanalytics.googleapis.com/v1/a2a/projects/"
228-
f"{gcp_project_id}/locations/{gcp_region}/"
229-
f"agents/dataengineeringagent"
246+
f"{host}/v1/a2a/projects/{gcp_project_id}/locations/{gcp_region}/"
247+
f"agents/{agent_name}"
230248
)
231249

232250
self.auth_interceptor = AuthInterceptor(GcpAdcCredentialService())
@@ -324,6 +342,11 @@ async def _run_client(
324342
message_req.metadata[GCP_RESOURCE_URI] = {
325343
"gcpResourceId": target_workspace
326344
}
345+
# Configure Agent Type extension
346+
if self.agent_name.lower() in ("sparkagent", "spark_agent", "spark"):
347+
message_req.metadata[AGENT_TYPE_URI] = "SPARK_AGENT"
348+
elif self.agent_name.lower() not in ("dataengineeringagent", "data_engineering_agent", "dea"):
349+
message_req.metadata[AGENT_TYPE_URI] = self.agent_name.upper()
327350

328351
# Handle ConversationToken state memory thread-safely
329352
token = ""

0 commit comments

Comments
 (0)