Skip to content

Commit ffe30c8

Browse files
committed
Refactor: Rename persona to instructions
1 parent 7cef10f commit ffe30c8

17 files changed

Lines changed: 40 additions & 40 deletions

‎README.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Configure an agent with a system prompt and execute a turn.
2424

2525
```java
2626
AgentConfig config = AgentConfig.builder()
27-
.persona("You are a helpful assistant.")
27+
.instructions("You are a helpful assistant.")
2828
.build();
2929

3030
try (AntigravityAgent agent = new AntigravityAgent(config)) {
@@ -39,7 +39,7 @@ Stream tokens as they are generated by the model.
3939

4040
```java
4141
AgentConfig config = AgentConfig.builder()
42-
.persona("Write a long story.")
42+
.instructions("Write a long story.")
4343
.build();
4444

4545
try (AntigravityAgent agent = new AntigravityAgent(config)) {
@@ -68,7 +68,7 @@ public class MyToolbox {
6868
}
6969

7070
AgentConfig config = AgentConfig.builder()
71-
.persona("You can fetch the weather.")
71+
.instructions("You can fetch the weather.")
7272
.addTool(new MyToolbox())
7373
.build();
7474
```
@@ -79,7 +79,7 @@ For advanced use-cases where tools need to be defined at runtime without classes
7979

8080
```java
8181
AgentConfig config = AgentConfig.builder()
82-
.persona("You can fetch the weather.")
82+
.instructions("You can fetch the weather.")
8383
.addTool(new DynamicTool() {
8484
@Override
8585
public String getName() { return "get_weather"; }
@@ -107,7 +107,7 @@ Extend your agent with complex capabilities by loading file-based skills contain
107107

108108
```java
109109
AgentConfig config = AgentConfig.builder()
110-
.persona("You are a specialized developer.")
110+
.instructions("You are a specialized developer.")
111111
.addSkillPath("/path/to/my-agent-skill")
112112
.addSkillPath("/path/to/another-skill")
113113
.build();
@@ -119,7 +119,7 @@ Restrict which tools the agent is allowed to execute using Security Policies.
119119

120120
```java
121121
AgentConfig config = AgentConfig.builder()
122-
.persona("You are restricted from running dangerous commands.")
122+
.instructions("You are restricted from running dangerous commands.")
123123
.addPolicy(new DenyAllPolicy()) // Blocks all tool executions by default
124124
.build();
125125
```
@@ -130,7 +130,7 @@ Hook into the agent's execution lifecycle to monitor, intercept, or modify inter
130130

131131
```java
132132
AgentConfig config = AgentConfig.builder()
133-
.persona("You are an observed agent.")
133+
.instructions("You are an observed agent.")
134134
.addHook(new PreTurnHook() {
135135
@Override
136136
public HookResult onPreTurn(TriggerContext context, AgentInput input) {

‎antigravity-sdk-wrapper/src/main/java/io/github/glaforge/antigravity/Agent.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ public Builder() {
149149
private final AgentConfig.Builder configBuilder = AgentConfig.builder();
150150

151151
/**
152-
* Sets the persona of the agent.
152+
* Sets the instructions of the agent.
153153
*
154-
* @param persona
155-
* the persona instructions
154+
* @param instructions
155+
* the system instructions
156156
* @return this builder
157157
*/
158-
public Builder persona(String persona) {
159-
configBuilder.persona(persona);
158+
public Builder instructions(String instructions) {
159+
configBuilder.instructions(instructions);
160160
return this;
161161
}
162162

@@ -455,7 +455,7 @@ public Agent(AgentConfig config) throws Exception {
455455
.setGeminiConfig(
456456
GeminiConfig.newBuilder().setModelName(config.getModelName()).setApiKey(apiKey).build())
457457
.setSystemInstructions(SystemInstructions.newBuilder().setAppended(
458-
AppendedSystemInstructions.newBuilder().setCustomIdentity(config.getPersona()).build())
458+
AppendedSystemInstructions.newBuilder().setCustomIdentity(config.getInstructions()).build())
459459
.build());
460460
for (Object obj : toolRegistry.getToolDefinitions()) {
461461
Tool toolDef = (Tool) obj;

‎antigravity-sdk-wrapper/src/main/java/io/github/glaforge/antigravity/AgentConfig.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Configuration for the Agent.
2626
*/
2727
public class AgentConfig {
28-
private final String persona;
28+
private final String instructions;
2929
private final String modelName;
3030
private final List<Object> toolInstances;
3131
private final List<String> skillsPaths;
@@ -41,7 +41,7 @@ public class AgentConfig {
4141
private final List<McpServerConfig> mcpServers;
4242

4343
private AgentConfig(Builder builder) {
44-
this.persona = builder.persona;
44+
this.instructions = builder.instructions;
4545
this.modelName = builder.modelName;
4646
this.toolInstances = new ArrayList<>(builder.toolInstances);
4747
this.skillsPaths = new ArrayList<>(builder.skillsPaths);
@@ -58,12 +58,12 @@ private AgentConfig(Builder builder) {
5858
}
5959

6060
/**
61-
* Returns the persona.
61+
* Returns the instructions.
6262
*
63-
* @return the persona
63+
* @return the instructions
6464
*/
65-
public String getPersona() {
66-
return persona;
65+
public String getInstructions() {
66+
return instructions;
6767
}
6868
/**
6969
* Returns the model name.
@@ -186,7 +186,7 @@ public static class Builder {
186186
/** Default constructor. */
187187
public Builder() {
188188
}
189-
private String persona = "";
189+
private String instructions = "";
190190
private String modelName = "gemini-2.5-flash";
191191
private List<Object> toolInstances = new ArrayList<>();
192192
private List<String> skillsPaths = new ArrayList<>();
@@ -202,14 +202,14 @@ public Builder() {
202202
private List<McpServerConfig> mcpServers = new ArrayList<>();
203203

204204
/**
205-
* Sets the persona.
205+
* Sets the instructions.
206206
*
207-
* @param persona
208-
* the persona
207+
* @param instructions
208+
* the instructions
209209
* @return this builder
210210
*/
211-
public Builder persona(String persona) {
212-
this.persona = persona;
211+
public Builder instructions(String instructions) {
212+
this.instructions = instructions;
213213
return this;
214214
}
215215

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/AgentConfigMcpTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AgentConfigMcpTest {
2424

2525
@Test
2626
void testMcpServerConfig() {
27-
AgentConfig config = AgentConfig.builder().persona("Test Persona")
27+
AgentConfig config = AgentConfig.builder().instructions("Test Persona")
2828
.addMcpServer(
2929
McpServerConfig.stdio("npx", List.of("-y", "@modelcontextprotocol/server-everything", "stdio")))
3030
.addMcpServer(McpServerConfig.sse("http://localhost:8080/sse")).build();

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/AgentSkillsTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void testAgentSkills() throws Exception {
3737

3838
Files.writeString(skillFile.toPath(), skillContent);
3939

40-
AgentConfig config = AgentConfig.builder().persona("""
40+
AgentConfig config = AgentConfig.builder().instructions("""
4141
You are a helpful assistant.
4242
Do NOT call any tools. Just output the text.
4343
""").addSkillPath(tempSkillDir.getAbsolutePath()).build();

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/AnnotationToolsTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Weather forecast(
4040
@Test
4141
public void testPojoToolInvocation() throws Exception {
4242
TestUtils.retry(3, () -> {
43-
AgentConfig config = AgentConfig.builder().persona("""
43+
AgentConfig config = AgentConfig.builder().instructions("""
4444
You are a weather bot.
4545
Always invoke the weather_forecast tool to get the weather, and tell the user the result.
4646
""").addTool(new MyToolbox()).modelName("gemini-2.5-flash").build();

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/BackgroundTriggersTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class BackgroundTriggersTest {
2727
@Test
2828
public void testBackgroundTriggers() throws Exception {
2929
TestUtils.retry(3, () -> {
30-
AgentConfig config = AgentConfig.builder().persona("""
30+
AgentConfig config = AgentConfig.builder().instructions("""
3131
You are an assistant. Wait for me to give you a command.
3232
If I sneeze, immediately say 'Bless you'.
3333
""").build();

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/HelloWorldTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Map<String, Object> getWeather(String location) {
3737
public void testWeatherAgent() throws Exception {
3838
TestUtils.retry(3, () -> {
3939
WeatherTools tools = new WeatherTools();
40-
try (Agent agent = Agent.builder().persona("""
40+
try (Agent agent = Agent.builder().instructions("""
4141
You are a helpful weather assistant.
4242
You MUST use the get_weather tool to fetch weather and NEVER use bash commands.
4343
""").modelName("gemini-2.5-flash").addTool(tools)

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/HooksTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void testLifecycleHooksOrder() throws Exception {
6666
return CompletableFuture.completedFuture(null);
6767
};
6868

69-
AgentConfig config = AgentConfig.builder().modelName("models/gemini-2.5-flash").persona("""
69+
AgentConfig config = AgentConfig.builder().modelName("models/gemini-2.5-flash").instructions("""
7070
You are a helpful assistant.
7171
If the user asks you to echo, you must call the echo tool EXACTLY ONCE.
7272
After the tool returns, immediately reply to the user with the result and finish the turn.

‎antigravity-sdk-wrapper/src/test/java/io/github/glaforge/antigravity/MultimodalTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void testDocumentInput() throws Exception {
3232
tempDoc.deleteOnExit();
3333
Files.writeString(tempDoc.toPath(), "The secret passcode is XYZ987.");
3434

35-
AgentConfig config = AgentConfig.builder().persona("""
35+
AgentConfig config = AgentConfig.builder().instructions("""
3636
You are a helpful assistant that answers questions based on provided documents.
3737
I am attaching a text document. You MUST read it and extract the passcode.
3838
""").build();

0 commit comments

Comments
 (0)