Skip to content

Commit ba2f93a

Browse files
Add agent protocol between fron and back
1 parent 9ffd334 commit ba2f93a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

agent-protocol.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Agent protocol between the front end and teh back end
2+
3+
The protocol is WebSocket based.
4+
The URL is /todo-agent/{todoId} (might change and drop the todoId at some point)
5+
6+
## Protocol messages
7+
8+
The protocol payload will be JSON with the following format
9+
10+
```
11+
{ "kind": "test",
12+
"todoId": 123,
13+
"payload": "Some String"
14+
}
15+
```
16+
17+
`payload` is optional unless explicitly mentioned, `kind` and `todoId` are mandatory
18+
19+
The kinds of messages are as follow:
20+
* `initialize` : a message the client must send right after opening the websocket
21+
* `cancel` : a message to send when the user clicks on `Cancel AI` ; after which the websocket connection is closed from the client side
22+
* `activity_log` : message sent by the server to the client when an activity info is to be displayed. Must have a `payload` field, this is text sent from the server that is to be displayed in **grey**, these strings are tokens / short and need to be concatenated in the "activity" screen, the server is responsible for sending `\n\n` (in a separate message or appended) when a message made of several tokens ends.
23+
* `agent_request` : message sent by the server to the client when a request to the user is made. Must have a `payload` field, this is text sent from the server that is to be displayed in **dark**, these strings are tokens / short strings and need to be concatenated in the "activity" screen, the server is responsible for sending `\n\n` (in a separate message or appended) when a message made of several tokens ends.
24+
* `user_message` : message sent by the client to the server when a user hit send on a chat message. Must have a `payload` field. The whole chat message is sent as one message.
25+
26+
## UX and interaction
27+
28+
Here is the UX and interaction
29+
* the UI will have one popup but bigger
30+
* it will allow you to edit or add a description and have `mark as done`, `delete` and `Do with AI` set of buttons
31+
* when clicking on `Do with AI` the UI will expand a bit below to show a "chat UI" whcih will act as the activity window and that's when the connection with the websocket is initialized
32+
* This activity shows logs from the server and so called agent requests (for context), this is when a user would send a chat message to the server
33+
* the `do with AI` button is replaced by a `Cancel AI work` button

0 commit comments

Comments
 (0)