mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: [Feature Branch] Update HTTP API to be consistent across languages (#2118)
This commit is contained in:
@@ -29,7 +29,7 @@ curl -i -X POST http://localhost:7071/api/agents/publisher/run \
|
||||
-d 'Start a content generation workflow for the topic \"The Future of Artificial Intelligence\"'
|
||||
|
||||
# Save the thread ID to a variable and print it to the terminal
|
||||
threadId=$(cat headers.txt | grep "X-Agent-Thread" | cut -d' ' -f2)
|
||||
threadId=$(cat headers.txt | grep "x-ms-thread-id" | cut -d' ' -f2)
|
||||
echo "Thread ID: $threadId"
|
||||
```
|
||||
|
||||
@@ -43,7 +43,7 @@ Invoke-RestMethod -Method Post `
|
||||
-Body 'Start a content generation workflow for the topic \"The Future of Artificial Intelligence\"' `
|
||||
|
||||
# Save the thread ID to a variable and print it to the console
|
||||
$threadId = $ResponseHeaders['X-Agent-Thread']
|
||||
$threadId = $ResponseHeaders['x-ms-thread-id']
|
||||
Write-Host "Thread ID: $threadId"
|
||||
```
|
||||
|
||||
@@ -52,12 +52,12 @@ The response will be a text string that looks something like the following, indi
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: text/plain
|
||||
X-Agent-Thread: @publisher@351ec855-7f4d-4527-a60d-498301ced36d
|
||||
x-ms-thread-id: @publisher@351ec855-7f4d-4527-a60d-498301ced36d
|
||||
|
||||
The content generation workflow for the topic "The Future of Artificial Intelligence" has been successfully started, and the instance ID is **6a04276e8d824d8d941e1dc4142cc254**. If you need any further assistance or updates on the workflow, feel free to ask!
|
||||
```
|
||||
|
||||
The `X-Agent-Thread` response header contains the thread ID, which can be used to continue the conversation by passing it as a query parameter to the `run` endpoint. The commands above show how to save the thread ID to a `$threadId` variable for use in subsequent requests.
|
||||
The `x-ms-thread-id` response header contains the thread ID, which can be used to continue the conversation by passing it as a query parameter (`thread_id`) to the `run` endpoint. The commands above show how to save the thread ID to a `$threadId` variable for use in subsequent requests.
|
||||
|
||||
Behind the scenes, the publisher agent will:
|
||||
|
||||
@@ -70,12 +70,12 @@ Bash (Linux/macOS/WSL):
|
||||
|
||||
```bash
|
||||
# Approve the content
|
||||
curl -X POST http://localhost:7071/api/agents/publisher/run?threadId=$threadId \
|
||||
curl -X POST "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" \
|
||||
-H "Content-Type: text/plain" \
|
||||
-d 'Approve the content'
|
||||
|
||||
# Reject the content with feedback
|
||||
curl -X POST http://localhost:7071/api/agents/publisher/run?threadId=$threadId \
|
||||
curl -X POST "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" \
|
||||
-H "Content-Type: text/plain" \
|
||||
-d 'Reject the content with feedback: The article needs more technical depth and better examples.'
|
||||
```
|
||||
@@ -85,13 +85,13 @@ PowerShell:
|
||||
```powershell
|
||||
# Approve the content
|
||||
Invoke-RestMethod -Method Post `
|
||||
-Uri http://localhost:7071/api/agents/publisher/run?threadId=$threadId `
|
||||
-Uri "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" `
|
||||
-ContentType text/plain `
|
||||
-Body 'Approve the content'
|
||||
|
||||
# Reject the content with feedback
|
||||
Invoke-RestMethod -Method Post `
|
||||
-Uri http://localhost:7071/api/agents/publisher/run?threadId=$threadId `
|
||||
-Uri "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" `
|
||||
-ContentType text/plain `
|
||||
-Body 'Reject the content with feedback: The article needs more technical depth and better examples.'
|
||||
```
|
||||
@@ -101,7 +101,7 @@ Once the workflow has completed, you can get the status by prompting the publish
|
||||
Bash (Linux/macOS/WSL):
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:7071/api/agents/publisher/run?threadId=$threadId \
|
||||
curl -X POST "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" \
|
||||
-H "Content-Type: text/plain" \
|
||||
-d 'Get the status of the workflow you previously started'
|
||||
```
|
||||
@@ -110,7 +110,7 @@ PowerShell:
|
||||
|
||||
```powershell
|
||||
Invoke-RestMethod -Method Post `
|
||||
-Uri http://localhost:7071/api/agents/publisher/run?threadId=$threadId `
|
||||
-Uri "http://localhost:7071/api/agents/publisher/run?thread_id=$threadId" `
|
||||
-ContentType text/plain `
|
||||
-Body 'Get the status of the workflow you previously started'
|
||||
```
|
||||
|
||||
@@ -9,19 +9,19 @@ Start a content generation workflow for the topic 'The Future of Artificial Inte
|
||||
@threadId = <YOUR_THREAD_ID>
|
||||
|
||||
### Check the status of the workflow
|
||||
POST http://localhost:7071/api/agents/publisher/run?threadId={{threadId}}
|
||||
POST http://localhost:7071/api/agents/publisher/run?thread_id={{threadId}}
|
||||
Content-Type: text/plain
|
||||
|
||||
Check the status of the workflow you previously started
|
||||
|
||||
### Reject content with feedback
|
||||
POST http://localhost:7071/api/agents/publisher/run?threadId={{threadId}}
|
||||
POST http://localhost:7071/api/agents/publisher/run?thread_id={{threadId}}
|
||||
Content-Type: text/plain
|
||||
|
||||
Reject the content with feedback: The article needs more technical depth and better examples.
|
||||
|
||||
### Approve content
|
||||
POST http://localhost:7071/api/agents/publisher/run?threadId={{threadId}}
|
||||
POST http://localhost:7071/api/agents/publisher/run?thread_id={{threadId}}
|
||||
Content-Type: text/plain
|
||||
|
||||
Approve the content
|
||||
|
||||
Reference in New Issue
Block a user