getAssistantGraph method

Future<Map<String, dynamic>> getAssistantGraph(
  1. String assistantId
)

Gets the graph definition for an assistant.

assistantId is the unique identifier of the assistant.

Returns the graph definition as a JSON map. Throws LangGraphApiException if the request fails.

Implementation

Future<Map<String, dynamic>> getAssistantGraph(String assistantId) async {
  try {
    final response = await client.get(
      Uri.parse('$baseUrl/assistants/$assistantId/graph'),
      headers: headers,
    );

    if (response.statusCode == 200) {
      return jsonDecode(response.body);
    }
    throw LangGraphApiException(
      'Failed to get assistant graph',
      response.statusCode,
    );
  } catch (e) {
    if (e is LangGraphApiException) rethrow;
    throw LangGraphApiException('Failed to get assistant graph: $e');
  }
}