Skip to content

List Agents

List cloud agents and check their statuses.

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
21
22
23
24
25
26
27
// Create a client with your Cursor API key.
using var client = new CursorAgentsClient(apiKey);

// List cloud agents for the authenticated user with a page limit.
var response = await client.ListAgentsAsync(
    limit: 10);

// The response contains a list of agents with their status and metadata.

foreach (var agent in response.Agents)
{

    Console.WriteLine($"Agent {agent.Id}: {agent.Name}");
    Console.WriteLine($"  Status: {agent.Status.ToValueString()}");
    Console.WriteLine($"  Created: {agent.CreatedAt}");

    if (agent.Summary is { Length: > 0 })
    {
        Console.WriteLine($"  Summary: {agent.Summary}");
    }
}

// Use the NextCursor property for pagination when there are more results.
if (response.NextCursor is { Length: > 0 })
{
    Console.WriteLine($"Next page cursor: {response.NextCursor}");
}