Skip to content

Get Conversation

Retrieve the conversation history of a cloud agent, including user prompts and assistant responses.

This example assumes using CursorAgents; is in scope and apiKey contains your CursorAgents API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// Create a client with your Cursor API key.
using var client = new CursorAgentsClient(apiKey);

var agentId =
    Environment.GetEnvironmentVariable("CURSORAGENTS_TEST_AGENT_ID") is { Length: > 0 } idValue
        ? idValue
        : throw new AssertInconclusiveException(
            "CURSORAGENTS_TEST_AGENT_ID environment variable is not found.");

// Retrieve the current metadata for a specific agent.
var response = await client.GetAgentAsync(
    id: agentId);

// The response contains the agent ID and current status.

if (response.Summary is { } summary)
{
    Console.WriteLine($"Agent {summary.Id}: {summary.Name}");
    Console.WriteLine($"Status: {summary.Status.ToValueString()}");
}