Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static class Action {

public enum Type {

start_workflow, complete_task, fail_task, terminate_workflow, update_workflow_variables
start_workflow, complete_task, fail_task, terminate_workflow, update_workflow_variables, start_agent
}

private Type action;
Expand All @@ -69,6 +69,8 @@ public enum Type {

private UpdateWorkflowVariables update_workflow_variables;

private StartAgent start_agent;

/**
* @return the action
*/
Expand Down Expand Up @@ -167,6 +169,20 @@ public UpdateWorkflowVariables getUpdate_workflow_variables() {
public void setUpdate_workflow_variables(UpdateWorkflowVariables update_workflow_variables) {
this.update_workflow_variables = update_workflow_variables;
}

/**
* @return the start_agent
*/
public StartAgent getStart_agent() {
return start_agent;
}

/**
* @param start_agent the start_agent to set
*/
public void setStart_agent(StartAgent start_agent) {
this.start_agent = start_agent;
}
}

public static class TaskDetails {
Expand Down Expand Up @@ -313,6 +329,125 @@ public void setTaskToDomain(Map<String, String> taskToDomain) {
}
}

/**
* Starts an execution of a previously deployed agent definition, identified by {@link #name}
* and optional {@link #version}.
*/
public static class StartAgent {

private String name;

private Integer version;

private String prompt;

private String sessionId;

private List<String> media;

private Map<String, Object> context;

private String idempotencyKey;

/**
* @return the name of the deployed agent definition to start
*/
public String getName() {
return name;
}

/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}

/**
* @return the version; the latest version is used when null
*/
public Integer getVersion() {
return version;
}

/**
* @param version the version to set
*/
public void setVersion(Integer version) {
this.version = version;
}

/**
* @return the prompt
*/
public String getPrompt() {
return prompt;
}

/**
* @param prompt the prompt to set
*/
public void setPrompt(String prompt) {
this.prompt = prompt;
}

/**
* @return the sessionId
*/
public String getSessionId() {
return sessionId;
}

/**
* @param sessionId the sessionId to set
*/
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}

/**
* @return the media
*/
public List<String> getMedia() {
return media;
}

/**
* @param media the media to set
*/
public void setMedia(List<String> media) {
this.media = media;
}

/**
* @return the context
*/
public Map<String, Object> getContext() {
return context;
}

/**
* @param context the context to set
*/
public void setContext(Map<String, Object> context) {
this.context = context;
}

/**
* @return the idempotencyKey
*/
public String getIdempotencyKey() {
return idempotencyKey;
}

/**
* @param idempotencyKey the idempotencyKey to set
*/
public void setIdempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}
}

public static class TerminateWorkflow {

private String workflowId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ void testSerializationDeserialization() throws Exception {
assertEquals(1, action.getUpdate_workflow_variables().getVariables().size());
assertTrue(action.getUpdate_workflow_variables().isAppendArray());

assertNotNull(action.getStart_agent());
assertEquals("sample_name", action.getStart_agent().getName());
assertEquals(Integer.valueOf(123), action.getStart_agent().getVersion());
assertEquals("sample_prompt", action.getStart_agent().getPrompt());
assertEquals("sample_sessionId", action.getStart_agent().getSessionId());
assertNotNull(action.getStart_agent().getMedia());
assertEquals(1, action.getStart_agent().getMedia().size());
assertNotNull(action.getStart_agent().getContext());
assertEquals(1, action.getStart_agent().getContext().size());
assertEquals("sample_idempotencyKey", action.getStart_agent().getIdempotencyKey());

// 3. Marshall this POJO to JSON again
String serializedJson = objectMapper.writeValueAsString(eventHandler);

Expand Down
26 changes: 23 additions & 3 deletions conductor-client/src/test/resources/ser_deser_json_string.json
Original file line number Diff line number Diff line change
Expand Up @@ -1319,13 +1319,15 @@
"action": "start_workflow",
"start_workflow": "${EventHandler.StartWorkflow}",
"complete_task": "${EventHandler.TaskDetails}",
"update_workflow_variables": "${EventHandler.UpdateWorkflowVariables}"
"update_workflow_variables": "${EventHandler.UpdateWorkflowVariables}",
"start_agent": "${EventHandler.StartAgent}"
},
"dependencies": [
"EventHandler.Action.Type",
"EventHandler.StartWorkflow",
"EventHandler.TaskDetails",
"EventHandler.TerminateWorkflow",
"EventHandler.StartAgent",
"EventHandler.UpdateWorkflowVariables"
]
},
Expand Down Expand Up @@ -1642,6 +1644,22 @@
},
"dependencies": []
},
"EventHandler.StartAgent": {
"content": {
"name": "sample_name",
"version": 123,
"prompt": "sample_prompt",
"sessionId": "sample_sessionId",
"media": [
"sample_media"
],
"context": {
"key": "sample_value"
},
"idempotencyKey": "sample_idempotencyKey"
},
"dependencies": []
},
"IntegrationDef": {
"content": {
"iconName": "sample_iconName",
Expand Down Expand Up @@ -1671,14 +1689,16 @@
"complete_task",
"fail_task",
"terminate_workflow",
"update_workflow_variables"
"update_workflow_variables",
"start_agent"
],
"constants": {
"terminate_workflow": "(3)",
"fail_task": "(2)",
"start_workflow": "(0)",
"complete_task": "(1)",
"update_workflow_variables": "(4)"
"update_workflow_variables": "(4)",
"start_agent": "(5)"
},
"sampleValue": "start_workflow"
},
Expand Down
Loading