Skip to content

Commit 9dc9569

Browse files
committed
Address remaining PR review comments
- Fix E225 spacing in workflow_aggregator_voting.py (Comment 4) - Translate Spanish agent/workflow display names in 7 Spanish files (Comments 5-8, 12-14) - Wrap long line in workflow_aggregator_structured.py (Comment 11) - Fix typo 'ass umptions' in workflow_magenticone.py (Comment 16) - Fix I001 import sorting in aggregator_ranked files - Fix UP035 Literal import in aggregator_structured files
1 parent 7998536 commit 9dc9569

11 files changed

Lines changed: 48 additions & 41 deletions

examples/spanish/workflow_aggregator_ranked.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from pydantic import BaseModel, Field
2525
from typing_extensions import Never
2626

27-
2827
load_dotenv(override=True)
2928
API_HOST = os.getenv("API_HOST", "github")
3029

@@ -113,7 +112,7 @@ async def run(
113112

114113
bold_writer = Agent(
115114
client=client,
116-
name="BoldWriter",
115+
name="EscritorAudaz",
117116
instructions=(
118117
"Eres un copywriter audaz y dramático. "
119118
"Dado el brief del producto, propone UN eslogan de marketing contundente (máx. 10 palabras). "
@@ -123,7 +122,7 @@ async def run(
123122

124123
minimalist_writer = Agent(
125124
client=client,
126-
name="MinimalistWriter",
125+
name="EscritorMinimalista",
127126
instructions=(
128127
"Eres un copywriter minimalista que valora la brevedad por encima de todo. "
129128
"Dado el brief del producto, propone UN eslogan de marketing ultra-corto (máx. 6 palabras). "
@@ -133,7 +132,7 @@ async def run(
133132

134133
emotional_writer = Agent(
135134
client=client,
136-
name="EmotionalWriter",
135+
name="EscritorEmocional",
137136
instructions=(
138137
"Eres un copywriter con enfoque empático. "
139138
"Dado el brief del producto, propone UN eslogan de marketing (máx. 10 palabras) "
@@ -147,7 +146,7 @@ async def run(
147146

148147
workflow = (
149148
WorkflowBuilder(
150-
name="FanOutFanInRanked",
149+
name="RankingFanOutFanIn",
151150
description="Generate slogans in parallel, then LLM-judge ranks them.",
152151
start_executor=dispatcher,
153152
output_executors=[ranker],

examples/spanish/workflow_aggregator_structured.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
import asyncio
1616
import os
1717
import sys
18+
from typing import Literal
1819

1920
from agent_framework import Agent, AgentExecutorResponse, Executor, Message, WorkflowBuilder, WorkflowContext, handler
2021
from agent_framework.openai import OpenAIChatClient
2122
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
2223
from dotenv import load_dotenv
2324
from pydantic import BaseModel, Field
24-
from typing_extensions import Literal, Never
25+
from typing_extensions import Never
2526

2627
load_dotenv(override=True)
2728
API_HOST = os.getenv("API_HOST", "github")
@@ -93,7 +94,8 @@ async def extract(
9394
role="system",
9495
text=(
9596
"Eres un revisor de un comité de contratación. "
96-
"Con base en las siguientes evaluaciones de entrevistadores, produce una revisión estructurada del candidato."
97+
"Con base en las siguientes evaluaciones de entrevistadores, "
98+
"produce una revisión estructurada del candidato."
9799
),
98100
),
99101
Message(role="user", text=combined),
@@ -107,7 +109,7 @@ async def extract(
107109

108110
technical_interviewer = Agent(
109111
client=client,
110-
name="TechnicalInterviewer",
112+
name="EntrevistadorTecnico",
111113
instructions=(
112114
"Eres un ingeniero senior haciendo una entrevista técnica. "
113115
"Evalúa las habilidades técnicas del candidato, su conocimiento de arquitectura y su capacidad de programar. "
@@ -117,7 +119,7 @@ async def extract(
117119

118120
behavioral_interviewer = Agent(
119121
client=client,
120-
name="BehavioralInterviewer",
122+
name="EntrevistadorConductual",
121123
instructions=(
122124
"Eres un especialista de RR.HH. haciendo una entrevista conductual. "
123125
"Evalúa comunicación, trabajo en equipo, resolución de conflictos y liderazgo. "
@@ -127,7 +129,7 @@ async def extract(
127129

128130
cultural_interviewer = Agent(
129131
client=client,
130-
name="CulturalInterviewer",
132+
name="EntrevistadorCultural",
131133
instructions=(
132134
"Eres un líder de equipo evaluando encaje cultural. "
133135
"Evalúa si el candidato se alinea con una cultura startup colaborativa y de ritmo rápido. "
@@ -139,7 +141,7 @@ async def extract(
139141

140142
workflow = (
141143
WorkflowBuilder(
142-
name="FanOutFanInStructured",
144+
name="ExtraccionEstructurada",
143145
description="Fan-out/fan-in with Pydantic structured extraction.",
144146
start_executor=dispatcher,
145147
output_executors=[extractor],

examples/spanish/workflow_aggregator_summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def run(self, results: list[AgentExecutorResponse], ctx: WorkflowContext[N
8686

8787
researcher = Agent(
8888
client=client,
89-
name="Researcher",
89+
name="Investigador",
9090
instructions=(
9191
"Eres un investigador de mercado experto. "
9292
"Dado el prompt, proporciona insights factuales concisos, oportunidades y riesgos. "
@@ -96,7 +96,7 @@ async def run(self, results: list[AgentExecutorResponse], ctx: WorkflowContext[N
9696

9797
marketer = Agent(
9898
client=client,
99-
name="Marketer",
99+
name="Estratega",
100100
instructions=(
101101
"Eres un estratega de marketing. "
102102
"Dado el prompt, propone una propuesta de valor clara y mensajes para la audiencia. "
@@ -120,7 +120,7 @@ async def run(self, results: list[AgentExecutorResponse], ctx: WorkflowContext[N
120120

121121
workflow = (
122122
WorkflowBuilder(
123-
name="FanOutFanInLLMSummary",
123+
name="ResumenLLMFanOutFanIn",
124124
description="Fan-out/fan-in with LLM summarization aggregation.",
125125
start_executor=dispatcher,
126126
output_executors=[summarizer],

examples/spanish/workflow_aggregator_voting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def tally(
104104

105105
keyword_classifier = Agent(
106106
client=client,
107-
name="KeywordClassifier",
107+
name="ClasificadorPalabraClave",
108108
instructions=(
109109
"Clasifica el ticket de soporte en exactamente una categoría: bug, billing, feature_request o general.\n"
110110
"Reglas:\n"
@@ -118,7 +118,7 @@ async def tally(
118118

119119
sentiment_classifier = Agent(
120120
client=client,
121-
name="SentimentClassifier",
121+
name="ClasificadorSentimiento",
122122
instructions=(
123123
"Clasifica el ticket de soporte en exactamente una categoría: bug, billing, feature_request o general.\n"
124124
"Analiza el tono emocional:\n"
@@ -132,7 +132,7 @@ async def tally(
132132

133133
intent_classifier = Agent(
134134
client=client,
135-
name="IntentClassifier",
135+
name="ClasificadorIntencion",
136136
instructions=(
137137
"Clasifica el ticket de soporte en exactamente una categoría: bug, billing, feature_request o general.\n"
138138
"Enfócate en lo que el usuario quiere lograr:\n"
@@ -148,7 +148,7 @@ async def tally(
148148

149149
workflow = (
150150
WorkflowBuilder(
151-
name="FanOutFanInVoting",
151+
name="VotacionFanOutFanIn",
152152
description="Ensemble classification with majority-vote aggregation.",
153153
start_executor=dispatcher,
154154
output_executors=[tally],

examples/spanish/workflow_fan_out_fan_in_edges.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def aggregate(
105105

106106
researcher = Agent(
107107
client=client,
108-
name="Researcher",
108+
name="Investigador",
109109
instructions=(
110110
"Eres un investigador de mercado experto. "
111111
"Dado el prompt, proporciona insights factuales concisos, oportunidades y riesgos. "
@@ -115,7 +115,7 @@ async def aggregate(
115115

116116
marketer = Agent(
117117
client=client,
118-
name="Marketer",
118+
name="Estratega",
119119
instructions=(
120120
"Eres un estratega de marketing. "
121121
"Dado el prompt, propone una propuesta de valor clara y mensajes para la audiencia. "
@@ -137,7 +137,7 @@ async def aggregate(
137137

138138
workflow = (
139139
WorkflowBuilder(
140-
name="FanOutFanInEdges",
140+
name="AristasDispersionReunion",
141141
description="Explicit fan-out/fan-in using edge groups.",
142142
start_executor=dispatcher,
143143
output_executors=[aggregator],

examples/spanish/workflow_handoffbuilder_rules.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,48 +64,48 @@
6464

6565
triage_agent = Agent(
6666
client=client,
67-
name="triage_agent",
67+
name="agente_triaje",
6868
instructions=(
6969
"Eres un agente de triage de soporte al cliente. Saluda al cliente, entiende su problema "
70-
"y haz handoff al especialista correcto: order_agent para temas de pedidos y "
71-
"return_agent para devoluciones. No puedes gestionar reembolsos directamente. "
70+
"y haz handoff al especialista correcto: agente_pedidos para temas de pedidos y "
71+
"agente_devoluciones para devoluciones. No puedes gestionar reembolsos directamente. "
7272
"Cuando el caso esté resuelto, di 'Goodbye!' (Goodbye/Adiós) para terminar la sesión."
7373
),
7474
)
7575

7676
order_agent = Agent(
7777
client=client,
78-
name="order_agent",
78+
name="agente_pedidos",
7979
instructions=(
8080
"Atiendes consultas sobre el estado del pedido. Busca el pedido del cliente y da una actualización breve. "
81-
"Al terminar, haz handoff de vuelta a triage_agent."
81+
"Al terminar, haz handoff de vuelta a agente_triaje."
8282
),
8383
)
8484

8585
return_agent = Agent(
8686
client=client,
87-
name="return_agent",
87+
name="agente_devoluciones",
8888
instructions=(
8989
"Atiendes devoluciones de productos. Ayuda al cliente a iniciar una devolución. "
90-
"Si también quiere un reembolso, haz handoff a refund_agent. "
91-
"De lo contrario, haz handoff de vuelta a triage_agent al terminar."
90+
"Si también quiere un reembolso, haz handoff a agente_reembolsos. "
91+
"De lo contrario, haz handoff de vuelta a agente_triaje al terminar."
9292
),
9393
)
9494

9595
refund_agent = Agent(
9696
client=client,
97-
name="refund_agent",
97+
name="agente_reembolsos",
9898
instructions=(
9999
"Procesas reembolsos por artículos devueltos. Confirma los detalles del reembolso y avísale "
100-
"al cliente cuándo puede esperar el dinero de vuelta. Haz handoff a triage_agent al terminar."
100+
"al cliente cuándo puede esperar el dinero de vuelta. Haz handoff a agente_triaje al terminar."
101101
),
102102
)
103103

104104
# ── Construye el workflow de handoff con reglas explícitas ─────────────────
105105

106106
workflow = (
107107
HandoffBuilder(
108-
name="customer_support_handoff",
108+
name="handoff_soporte_cliente",
109109
participants=[triage_agent, order_agent, return_agent, refund_agent],
110110
termination_condition=lambda conversation: (
111111
len(conversation) > 0 and "goodbye" in conversation[-1].text.lower()

examples/spanish/workflow_magenticone.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"Sugieres actividades locales auténticas e interesantes o lugares para visitar, "
5757
"usando cualquier contexto que provea la persona usuaria u otros agentes."
5858
),
59-
name="local_agent",
59+
name="agente_local",
6060
description="Specialist in local activities and places.",
6161
)
6262

@@ -66,7 +66,7 @@
6666
"Revisas planes de viaje y das recomendaciones prácticas para retos de idioma "
6767
"y comunicación en el destino. Si ya está bien cubierto, menciónalo con una razón clara."
6868
),
69-
name="language_agent",
69+
name="agente_idioma",
7070
description="Specialist in language and communication advice.",
7171
)
7272

@@ -79,13 +79,13 @@
7979
"No pidas confirmaciones ni permisos. "
8080
"YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN."
8181
),
82-
name="travel_summary_agent",
82+
name="agente_resumen_viaje",
8383
description="Specialist in travel-plan synthesis.",
8484
)
8585

8686
manager_agent = Agent(
8787
client=client,
88-
name="manager_agent",
88+
name="agente_coordinador",
8989
description="Magentic manager that coordinates specialists.",
9090
instructions=(
9191
"Coordinas especialistas para resolver tareas complejas de forma eficiente. "

examples/workflow_aggregator_ranked.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from pydantic import BaseModel, Field
2525
from typing_extensions import Never
2626

27-
2827
load_dotenv(override=True)
2928
API_HOST = os.getenv("API_HOST", "github")
3029

examples/workflow_aggregator_structured.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
import asyncio
1616
import os
1717
import sys
18+
from typing import Literal
1819

1920
from agent_framework import Agent, AgentExecutorResponse, Executor, Message, WorkflowBuilder, WorkflowContext, handler
2021
from agent_framework.openai import OpenAIChatClient
2122
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
2223
from dotenv import load_dotenv
2324
from pydantic import BaseModel, Field
24-
from typing_extensions import Literal, Never
25+
from typing_extensions import Never
2526

2627
load_dotenv(override=True)
2728
API_HOST = os.getenv("API_HOST", "github")
@@ -89,7 +90,13 @@ async def extract(
8990
combined = "\n\n".join(sections)
9091

9192
messages = [
92-
Message(role="system", text="You are a hiring committee reviewer. Based on the following interviewer assessments, produce a structured candidate review."),
93+
Message(
94+
role="system",
95+
text=(
96+
"You are a hiring committee reviewer. "
97+
"Based on the following interviewer assessments, produce a structured candidate review."
98+
),
99+
),
93100
Message(role="user", text=combined),
94101
]
95102
response = await self._client.get_response(messages, options={"response_format": CandidateReview})

examples/workflow_aggregator_voting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def tally(
8585
"""Count classifier votes and yield the winning category."""
8686
votes: list[tuple[str, str]] = []
8787
for result in results:
88-
classification: Classification= result.agent_response.value
88+
classification: Classification = result.agent_response.value
8989
votes.append((result.executor_id, classification.category.value))
9090

9191
labels = [label for _, label in votes]

0 commit comments

Comments
 (0)