You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: start from AP in JSON format
* feat: ACP update on top of AP
* fix: remove additionalProperties
* docs: update docs for 0.2
* fix: add 409
* fix: improve description for blocking runs and Record URL
* fix: resume_stateless_run operationId
* fix: change operationId for resume_thread_run
---------
Co-authored-by: Marco Trinelli (mtrinell) <mtrinell@cisco.com>
C->>+S: POST /runs/{run_id} {interrupt_type, resume_payload}
155
155
S->>-C: Run={run_id, status="pending"}
156
-
C->>+S: GET /runs/{run_id}/output
156
+
C->>+S: GET /runs/{run_id}/wait
157
157
S->>-C: RunOutput={type="result", result}
158
158
```
159
159
In the sequence above:
@@ -174,6 +174,8 @@ Subsequent runs on the same thread use the previously created state, together wi
174
174
175
175
The server offers ways to retrieve the current thread state, the history of the runs on a thread, and the evolution of the thread states over execution of runs.
176
176
177
+
Runs over the same thread can be executed on different agents, as long as the agents support the same thread state format.
178
+
177
179
>
178
180
> Note that the format of the thread state is not specified by ACP, but it is (optionally) defined in the agent ACP descriptor. If specified, it can be retrieved by the client, if not it's not accessible to the client.
179
181
>
@@ -186,45 +188,47 @@ sequenceDiagram
186
188
participant C as ACP Client
187
189
participant S as ACP Server
188
190
rect rgb(240,240,240)
189
-
C->>+S: POST /runs {agent_id, message="Hello, my name is John?", config, metadata}
190
-
S->>-C: Run={run_id, status="pending", thread_id}
191
-
C->>+S: GET /runs/{run_id}/output {"block_timeout"=60}
191
+
C->>+S: POST /threads
192
+
S->>-C: Thread={thread_id, status="idle"}
193
+
C->>+S: POST /threads/{thread_id}/runs {agent_id, message="Hello, my name is John?", config, metadata}
194
+
S->>-C: Run={run_id, status="pending"}
195
+
C->>+S: GET /threads/{thread_id}/runs/{run_id}/wait
192
196
S->>-C: RunOutput={type="result", result={"message"="Hello John, how can I help?"}}
193
197
end
194
198
note right of S: state=[<br/>"Hello, my name is John?",<br/>"Hello John, how can I help?"<br/>]
195
199
rect rgb(240,240,240)
196
-
C->>+S: POST /runs {agent_id, message="Can you remind my name?", config, metadata, thread_id}
197
-
S->>-C: Run={run_id, status="pending", thread_id}
198
-
C->>+S: GET /runs/{run_id}/output {"block_timeout"=60}
200
+
C->>+S: POST /threads/{thread_id}/runs {agent_id, message="Can you remind my name?", config, metadata}
201
+
S->>-C: Run={run_id, status="pending"}
202
+
C->>+S: GET /threads/{thread_id}/runs/{run_id}/wait
199
203
S->>-C: RunOutput={type="result", result={"message"="Yes, your name is John"}}
200
204
end
201
205
note right of S: state=[<br/>"Hello, my name is John?",<br/>"Hello John, how can I help?"<br/>"Can you remind my name?",<br/>"Yes, your name is John"<br/>]
202
-
C->>+S: GET /threads/{thread_id}/state {thread_id}
203
-
S->>-C: ThreadState=[<br/>"Hello, my name is John?",<br/>"Hello John, how can I help?"<br/>"Can you remind my name?",<br/>"Yes, your name is John"<br/>]
206
+
C->>+S: GET /threads/{thread_id}
207
+
S->>-C: Thread{thread_id, status="idle", values=[<br/>"Hello, my name is John?",<br/>"Hello John, how can I help?"<br/>"Can you remind my name?",<br/>"Yes, your name is John"<br/>]}
204
208
```
205
209
In the sequence above:
206
-
1. The client starts the first run and provides the first message of the chat.
207
-
1. The server returns the run object which **includes a thread ID** because the server supports thread runs.
210
+
1. The client requests to create a thread on the server
211
+
1. The server returns a thread object that contains a thread ID
212
+
1. The client starts the first run on the created thread and provides the first message of the chat.
213
+
1. The server returns the run object.
208
214
1. The client requests the run output.
209
215
1. The server returns the run output which is the next chat message from the agent and leaves a state with the current chat history.
210
-
1. The client starts a new run providing:
211
-
* The same thread ID, which means that the run will use the existing state associated with the thread.
212
-
* The input for the run, i.e. the next message in the chat (assuming the existence of the chat history on the server).
216
+
1. The client starts a new run on the same thread providing the input for the run, i.e. the next message in the chat (assuming the existence of the chat history on the server).
213
217
1. The server starts the runs using the existing chat history and returns the run object.
214
218
1. The client requests the run output.
215
219
1. The server updates the thread state and returns the run output.
216
220
1. Finally, the client requests the thread state (this is an optional operation).
217
-
1. The server returns the current thread state which collects the whole chat history.
221
+
1. The server returns the current thread object which collects the whole chat history.
218
222
219
223
### Output Streaming
220
-
ACP supports output streaming. Agent can stream intermediate results of a Run to provide better response time and user experience.
224
+
ACP supports output streaming. Agent can stream partial results of a Run to provide better response time and user experience.
221
225
222
226
ACP implements streaming using Server Sent Events specified here: https://html.spec.whatwg.org/multipage/server-sent-events.html.
223
227
224
228
In a nutshell, the client keeps the HTTP connection open and receives a stream of events from the server, where each event carries an update of the run result.
225
229
226
230
ACP supports 2 streaming modes:
227
-
1.**result** where each event contains a full instance of the RunResult, which fully replace the previous update.
231
+
1.**values** where each event contains a full instance of the agent output, which fully replace the previous update.
228
232
2.**custom** where the schema of the event is left unspecified by ACP, which it can be specified in the specific agent ACP descriptor under `spec.custom_streaming_update`
229
233
230
234
#### Start a Run and stream output until completion
0 commit comments