> This page is for version v5.0 (default).
> For other versions, use one of these documentation indexes:
> - v5.0 (default): https://humanloop.com/docs/v5/llms.txt
> - v4.0: https://humanloop.com/docs/v4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/docs/_mcp/server.

# Continue Agent Call

POST https://api.humanloop.com/v5/agents/continue
Content-Type: application/json

Continue an incomplete Agent call.

This endpoint allows continuing an existing incomplete Agent call, by passing the tool call
requested by the Agent. The Agent will resume processing from where it left off.

The messages in the request will be appended to the original messages in the Log. You do not
have to provide the previous conversation history.

The original log must be in an incomplete state to be continued.

Reference: https://humanloop.com/docs/api/agents/continue-call

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an object.

- `log_id` (string, required) — This identifies the Agent Log to continue.
- `messages` (list of ChatMessage, required) — The additional messages with which to continue the Agent Log. Often, these should start with the Tool messages with results for the previous Assistant message's tool calls.
- `stream` (true, required) — If true, packets will be sent as data-only server-sent events.
- `provider_api_keys` (ProviderApiKeys, optional) — API keys required by each provider to make API calls. The API keys provided here are not stored by Humanloop. If not specified here, Humanloop will fall back to the key saved to your organization.
- `include_trace_children` (boolean, optional, default: false) — If true, populate `trace_children` for the returned Agent Log. Defaults to false.

## Response

### 200

- Streaming response of `AgentContinueCallStreamResponse`.
- `log_id` (string, required)
- `message` (string, required)
- `type` (enum, required) — An enumeration.
  - Allowed values: `agent_turn_start`, `agent_turn_suspend`, `agent_turn_continue`, `agent_turn_end`, `agent_turn_error`, `agent_start`, `agent_update`, `agent_end`, `tool_start`, `tool_update`, `tool_end`, `error`
- `created_at` (datetime, required)
- `payload` (AgentContinueCallStreamResponsePayload, optional)

## Errors

### 422 Agents Continue Call Stream Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ChatMessage

- `role` (enum, required) — Role of the message author.
  - Allowed values: `user`, `assistant`, `system`, `tool`, `developer`
- `content` (ChatMessageContent, optional) — The content of the message.
- `name` (string, optional) — Optional name of the message author.
- `tool_call_id` (string, optional) — Tool call that this message is responding to.
- `tool_calls` (list of ToolCall, optional) — A list of tool calls requested by the assistant.
- `thinking` (list of ChatMessageThinkingItem, optional) — Model's chain-of-thought for providing the response. Present on assistant messages if model supports it.

### ProviderApiKeys

- `openai` (string, optional)
- `mock` (string, optional)
- `anthropic` (string, optional)
- `deepseek` (string, optional)
- `bedrock` (string, optional)
- `cohere` (string, optional)
- `openai_azure` (string, optional)
- `openai_azure_endpoint` (string, optional)
- `google` (string, optional)

### AgentContinueCallStreamResponsePayload

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ChatMessageContent

The content of the message.

### ToolCall

A tool call to be made.

- `id` (string, required)
- `type` ("function", required) — The type of tool to call.
- `function` (FunctionTool, required) — A function tool to be called by the model where user owns runtime.

### ChatMessageThinkingItem

### ValidationErrorLocItem

### FunctionTool

A function tool to be called by the model where user owns runtime.

- `name` (string, required)
- `arguments` (string, optional)

### AnthropicThinkingContent

- `type` ("thinking", required)
- `thinking` (string, required) — Model's chain-of-thought for providing the response.
- `signature` (string, required) — Cryptographic signature that verifies the thinking block was generated by Anthropic.

### AnthropicRedactedThinkingContent

- `type` ("redacted_thinking", required)
- `data` (string, required) — Thinking block Anthropic redacted for safety reasons. User is expected to pass the block back to Anthropic

## Examples

**Request**

```json
{
  "log_id": "log_id",
  "messages": [
    {
      "role": "user"
    }
  ],
  "stream": true
}
```

**Response**

```text
event: 
data: {"log_id":"log_id","message":"message","payload":{"output":"output","created_at":"2024-01-15T09:30:00Z","error":"error","provider_latency":1.1,"stdout":"stdout","output_message":{"content":"content","name":"name","tool_call_id":"tool_call_id","role":"user","tool_calls":[{"id":"id","type":"function","function":{"name":"name"}}],"thinking":[{"type":"thinking","thinking":"thinking","signature":"signature"}]},"prompt_tokens":1,"reasoning_tokens":1,"output_tokens":1,"prompt_cost":1.1,"output_cost":1.1,"finish_reason":"finish_reason","index":1,"id":"id","prompt_id":"prompt_id","version_id":"version_id"},"type":"agent_turn_start","created_at":"2024-01-15T09:30:00Z"}
```

**SDK Code**

```python
import requests

url = "https://api.humanloop.com/v5/agents/continue"

payload = {
    "log_id": "log_id",
    "messages": [{ "role": "user" }],
    "stream": True
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript
import { HumanloopClient } from "humanloop";

const client = new HumanloopClient({ apiKey: "YOUR_API_KEY" });
const response = await client.agents.continueCallStream({
    logId: "log_id",
    messages: [{
            role: "user"
        }]
});
for await (const item of response) {
    console.log(item);
}

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.humanloop.com/v5/agents/continue"

	payload := strings.NewReader("{\n  \"log_id\": \"log_id\",\n  \"messages\": [\n    {\n      \"role\": \"user\"\n    }\n  ],\n  \"stream\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.humanloop.com/v5/agents/continue")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"log_id\": \"log_id\",\n  \"messages\": [\n    {\n      \"role\": \"user\"\n    }\n  ],\n  \"stream\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.humanloop.com/v5/agents/continue")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"log_id\": \"log_id\",\n  \"messages\": [\n    {\n      \"role\": \"user\"\n    }\n  ],\n  \"stream\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.humanloop.com/v5/agents/continue', [
  'body' => '{
  "log_id": "log_id",
  "messages": [
    {
      "role": "user"
    }
  ],
  "stream": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v5/agents/continue");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"log_id\": \"log_id\",\n  \"messages\": [\n    {\n      \"role\": \"user\"\n    }\n  ],\n  \"stream\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "log_id": "log_id",
  "messages": [["role": "user"]],
  "stream": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v5/agents/continue")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```