fix: Fixes the identity prompt to be one line and add ending period after description statement

From

```
You are an agent. Your internal name is "agent".

 The description about you is "test description"
```

to

```
You are an agent. Your internal name is "agent". The description about you is "test description".
```

PiperOrigin-RevId: 822358196
This commit is contained in:
Wei Sun (Jack)
2025-10-21 18:31:48 -07:00
committed by Copybara-Service
parent aab2504ebd
commit 7d5c6b9acf
2 changed files with 8 additions and 7 deletions
+3 -3
View File
@@ -34,10 +34,10 @@ class _IdentityLlmRequestProcessor(BaseLlmRequestProcessor):
self, invocation_context: InvocationContext, llm_request: LlmRequest
) -> AsyncGenerator[Event, None]:
agent = invocation_context.agent
si = [f'You are an agent. Your internal name is "{agent.name}".']
si = f'You are an agent. Your internal name is "{agent.name}".'
if agent.description:
si.append(f' The description about you is "{agent.description}"')
llm_request.append_instructions(si)
si += f' The description about you is "{agent.description}".'
llm_request.append_instructions([si])
# Maintain async generator behavior
if False: # Ensures it behaves as a generator
@@ -64,7 +64,8 @@ async def test_with_description():
):
pass
assert request.config.system_instruction == "\n\n".join([
'You are an agent. Your internal name is "agent".',
' The description about you is "test description"',
])
assert (
request.config.system_instruction
== """\
You are an agent. Your internal name is "agent". The description about you is "test description"."""
)